Skip to content

OpenCV4 createsamples and traincascade are missing from build/apps #13231

Closed

Description

@ChernyshovYuriy

Hey,
I built opencv 4.0.0 with

cmake -D CMAKE_BUILD_TYPE=RELEASE
-D BUILD_opencv_apps=ON
-D OPENCV_EXTRA_MODULES_PATH=<path_to...>/modules ..

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

Versions 3.4.X worked fine.

Is this changed recently?

Activity

  1. alalek commented on Nov 21, 2018

    @alalek
    Member

    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.

  2. ChernyshovYuriy commented on Nov 21, 2018

    @ChernyshovYuriy
    Author

    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 :-)

  3. StevenPuttemans commented on Jan 16, 2019

    @StevenPuttemans

    @alalek

    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 ...

  4. tow70 commented on Feb 15, 2019

    @tow70

    If opencv_createsamples and opencv_traincascade are obsolete, how can I train a classifier? Or are CascadeClassifier and detectMultiScale also obsolete?

  5. StevenPuttemans commented on Feb 15, 2019

    @StevenPuttemans

    @tow70

    • You can revert back to version 3.4, which does contain the functionality
    • You can pick up the GSoC2019 proposal for reintegrating this functionality in an updated manner :)
  6. tow70 commented on Feb 15, 2019

    @tow70

    @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.

  7. StevenPuttemans commented on Feb 15, 2019

    @StevenPuttemans

    If you want the cascade to be used by an opencv software package, then 3.4 is the only solution.

  8. vpisarev commented on Feb 20, 2019

    @vpisarev
    Contributor

    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!

  9. iruriksl commented on Aug 16, 2020

    @iruriksl

    opencv_createsamples

    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

  10. makingglitches commented on Jun 22, 2021

    @makingglitches

    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 ?

  11. Kreijstal commented on Mar 22, 2022

    @Kreijstal

    how do I train a cascade classifier in opencv without mixing versions?

  12. berak commented on Mar 22, 2022

    @berak
    Contributor

    @Kreijstal

    • 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
  13. Kreijstal commented on Mar 23, 2022

    @Kreijstal

    @Kreijstal

    * 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.

  14. schardong commented on Mar 30, 2022

    @schardong

    @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.

  15. fdivitto commented on Mar 22, 2023

    @fdivitto
    Contributor

    Hello,
    I've just added a Pull Request to fix traincascade application.

    #23393

  16. 71walceli commented on Jul 30, 2023

    @71walceli

    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...

  17. 71walceli commented on Jul 30, 2023

    @71walceli

    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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCcategory: apps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions