You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenCV4 createsamples and traincascade are missing from build/apps #13231
However, in "build/app" there are no createsamples and traincascade. There are annotation, interractive-calibration, version and visualisation only.
These folders are present in <opencv_src>/apps.
OS - Ubuntu 16.06 LTS
These apps has been disabled during legacy C API removal. Rewriting them with C++ API was not an option because it is too easy to break them and hard to test.
Also modern approaches via DNN provides much better results - just compare OpenCV face detector with CascadeClassifier and DNN.
So these apps are candidates to removal.
Consider using these apps for training from 3.4 branch for Cascade Classifier. Model format is the same between 3.4 and 4.x.
Reacted by Suleyman TURKMEN, Yurii Chernyshov, 陈庆伟, Elton fernandes dos santos, mkcoldwolf and berak
Reacted by Takuya MINAGAWA, Johannes Berger, Natthapawn Hongcharoen, Fabio Manganiello, Stephen Bunn, stasPetrenko153, Ege Özkan , Pieter Meiresone, Melissa, Nycticebus and 6 more
Reacted by Steven Puttemans, Takuya MINAGAWA, Killian Q. Zhuo, Johannes Berger, Caleb Xavier Berger, benzwt, qitsweauca, Stephen Bunn, stasPetrenko153, CGreen11 and 10 more
Thanks a lot for quick response!
I am going to close this ticket, however, would be good to have some kind of text document placed in "build/apps" with the same explanation, so people like me will not be confused in future :-)
Reacted by x011, Shreyans Jasoriya, Vladimir Kravchenko, berak, Viktor Gilko, katakaku and Mikhail Samokhin
Also modern approaches via DNN provides much better results - just compare OpenCV face detector with CascadeClassifier and DNN.
So these apps are candidates to removal.
I agree that these algorithms are old, and not up to date, but removing them? Cascade Classifiers have nowadays still several implementations and applications in tons of fields. Yes DL is a valid alternative, but removing them from OpenCV, seeing how much documentation out there (books, courses, ...) use it as a base for classic CV, this will generate a shitload of similar discussions ...
Reacted by Takuya MINAGAWA, Tilo Wütherich, Joseph Howse, Natthapawn Hongcharoen, Dejan, Caleb Xavier Berger, Shreyans Jasoriya, triswan, Edward Luo, Abhishek Choudhary and 31 more
If opencv_createsamples and opencv_traincascade are obsolete, how can I train a classifier? Or are CascadeClassifier and detectMultiScale also obsolete?
Reacted by CGreen11, chen, Akash Rajendra, JohanLink, Gabor Szita, Marshall Hallenbeck and Dario Cotza
Reacted by Zhongxuan (Daniel) Wang, chen, Akash Rajendra, cc, Shreyas Poyarekar and Dario Cotza
Thanks for the quick reply! For testing purposes I will keep my 3.4 installation. I'm not a programmer, so it will be better to keep my hands off the GSoC 2019 proposal.
One intention of my request was to find an alternative tool to opencv_traincascade to generate the cascade.xml. Perhaps someone has a hint or a weblink.
If there are volunteers for that, opencv_createsamples and opencv_traincascade can be updated to compile with OpenCV 4. For now, it's perfectly fine to download and build OpenCV 3.4 side by side with OpenCV 4.0, take opencv_createsamples and opencv_traincascade from OpenCV 3.4 to create the models. Those models can then be used with OpenCV 3.x and OpenCV 4.x - no problem!
Reacted by Laurent Thomas, Shreyans Jasoriya, Andrei Buiza, Fabio Manganiello, Simon Andersen, Vivek Banzade, Sebastiii, iruriksl, Aaron John Sabu, JohanLink and 3 more
Reacted by Steven Puttemans, Sebastiii and Dawid Szewc
opencv_createsamples is building perfect with vision 4.2 master. Only problems in opencv_traincascades is there to work voluntarily as this seems important.
Hopethis information helps many others.
I will try to volunteer for the fixing opencv_traincascade apps of opencv
Reacted by Rosti, Samuel Audet, Danny-Dunn, Alexander Alekhin and Stack-it-up
So... haar cascaders are still there and the trained models.. sort of working.
but... the way of training the cascader is no longer there ?
there was mention of other methods that more up to date ?
bit behind the curve so i'm confused how to utilize this lib if a pretty big part of it is no longer valid.
what tool combinations should i be using to create specific search models for specific types of objects ?
Reacted by Karim botros, James Brown and Stack-it-up
* git checkout the 3.4 branch
* cmake && make (just do NOT run 'make install')
* run the cascade tools from `build/bin` to train your cascade
* throw away the build folder & checkout some 4.x branch again
I think this is precisely what I was trying to avoid, I guess there is no way to not mix the versions, aka no way to train cascade with a current modern version, shame.
@Kreijstal
Well, the traincascade binary did not compile for me as per version 4.5.5, only createsamples did without errors. I just checked-out the 4.5.5 branch and uncommented line 57 in the apps/CMakeLists.txt file, built opencv using cmake && make, as per @berak and that was it actually. The binary is inside the build/bin directory.
If you want to use the traincascade binary, I'm afraid you will have to revert to version 3.4, just don't install it after the build, so it won't pollute your setup.
Unsurprisingly for me, build failed on step 5 because one of those packages was missing:
Package libav-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
ffmpeg
E: Package 'libav-tools' has no installation candidate
E: Unable to locate package libjasper-dev
The command '/bin/sh -c apt-get update && apt-get install -y wget build-essential cmake git unzip pkg-config python-dev python-opencv libopencv-dev libav-tools libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libatlas-base-dev gfortran webp python-opencv qt5-default libvtk6-dev zlib1g-dev' returned a non-zero code: 100
UPDATE: On step 5, missing package is libjasper-dev. So far, @berak 's steps are working so far...
Activity
alalek commentedon Nov 21, 2018
These apps has been disabled during legacy C API removal. Rewriting them with C++ API was not an option because it is too easy to break them and hard to test.
Also modern approaches via DNN provides much better results - just compare OpenCV face detector with CascadeClassifier and DNN.
So these apps are candidates to removal.
Consider using these apps for training from 3.4 branch for Cascade Classifier. Model format is the same between 3.4 and 4.x.
ChernyshovYuriy commentedon Nov 21, 2018
Thanks a lot for quick response!
I am going to close this ticket, however, would be good to have some kind of text document placed in "build/apps" with the same explanation, so people like me will not be confused in future :-)
sturkmen72 commentedon Nov 21, 2018
@alalek let me remove https://docs.opencv.org/master/dc/d88/tutorial_traincascade.html from the documentation
StevenPuttemans commentedon Jan 16, 2019
@alalek
I agree that these algorithms are old, and not up to date, but removing them? Cascade Classifiers have nowadays still several implementations and applications in tons of fields. Yes DL is a valid alternative, but removing them from OpenCV, seeing how much documentation out there (books, courses, ...) use it as a base for classic CV, this will generate a shitload of similar discussions ...
tow70 commentedon Feb 15, 2019
If opencv_createsamples and opencv_traincascade are obsolete, how can I train a classifier? Or are CascadeClassifier and detectMultiScale also obsolete?
StevenPuttemans commentedon Feb 15, 2019
@tow70
tow70 commentedon Feb 15, 2019
@StevenPuttemans
Thanks for the quick reply! For testing purposes I will keep my 3.4 installation. I'm not a programmer, so it will be better to keep my hands off the GSoC 2019 proposal.
One intention of my request was to find an alternative tool to opencv_traincascade to generate the cascade.xml. Perhaps someone has a hint or a weblink.
StevenPuttemans commentedon Feb 15, 2019
If you want the cascade to be used by an opencv software package, then 3.4 is the only solution.
completely new C++ persistence implementation (#13011)
vpisarev commentedon Feb 20, 2019
If there are volunteers for that, opencv_createsamples and opencv_traincascade can be updated to compile with OpenCV 4. For now, it's perfectly fine to download and build OpenCV 3.4 side by side with OpenCV 4.0, take opencv_createsamples and opencv_traincascade from OpenCV 3.4 to create the models. Those models can then be used with OpenCV 3.x and OpenCV 4.x - no problem!
iruriksl commentedon Aug 16, 2020
opencv_createsamples is building perfect with vision 4.2 master. Only problems in opencv_traincascades is there to work voluntarily as this seems important.
Hopethis information helps many others.
I will try to volunteer for the fixing opencv_traincascade apps of opencv
makingglitches commentedon Jun 22, 2021
So... haar cascaders are still there and the trained models.. sort of working.
but... the way of training the cascader is no longer there ?
there was mention of other methods that more up to date ?
bit behind the curve so i'm confused how to utilize this lib if a pretty big part of it is no longer valid.
what tool combinations should i be using to create specific search models for specific types of objects ?
Kreijstal commentedon Mar 22, 2022
how do I train a cascade classifier in opencv without mixing versions?
berak commentedon Mar 22, 2022
@Kreijstal
build/binto train your cascadeKreijstal commentedon Mar 23, 2022
I think this is precisely what I was trying to avoid, I guess there is no way to not mix the versions, aka no way to train cascade with a current modern version, shame.
schardong commentedon Mar 30, 2022
@Kreijstal
Well, the
traincascadebinary did not compile for me as per version 4.5.5, onlycreatesamplesdid without errors. I just checked-out the 4.5.5 branch and uncommented line 57 in theapps/CMakeLists.txtfile, built opencv usingcmake && make, as per @berak and that was it actually. The binary is inside thebuild/bindirectory.If you want to use the
traincascadebinary, I'm afraid you will have to revert to version 3.4, just don't install it after the build, so it won't pollute your setup.fdivitto commentedon Mar 22, 2023
Hello,
I've just added a Pull Request to fix traincascade application.
#23393
71walceli commentedon Jul 30, 2023
Would you recommend this one for Docker? https://stackoverflow.com/a/36864891
Is there a more recent one for Python 3?
UPDATE: On step 5, missing package is
libjasper-dev. So far, @berak 's steps are working so far...71walceli commentedon Jul 30, 2023
Unsurprisingly for me, build failed on step 5 because one of those packages was missing:
UPDATE: On step 5, missing package is
libjasper-dev. So far, @berak 's steps are working so far...