####Resources
- http://docs.opencv.org/doc/user_guide/ug_traincascade.html#
- http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html
- http://note.sonots.com/SciSoftware/haartraining.html#w0a08ab4
- "How many images do we need? The numbers depend on a variety of factors, including the quality of the images, the object you want to recognize, the method to generate the samples, the CPU power you have and probably some magic."
- http://www.technolabsz.com/2011/08/how-to-do-opencv-haar-training.html
- "It would be a great investigation for any future group to test the performance of the classifier using varying numbers of training images."
####Goals
- Parameter tuning
- Logical code analysis
- Algorithm enhancements
####Generating negative samples
- To generate tons of negative samples fast, download a YouTube video (http://www.clipconverter.cc/) and grab frames with the command
ffmpeg -i file.mp4 -r 2 %03d.jpg
in Ubuntu - Use mogrify to resize the images to a maximum width and height
mogrify -resize 256x256 *.jpg
- Convert all pngs to jpegs
mogrify -format jpg *.png
- You can escape and continue the opencv_traincascade program. It will load the previously finished stage and continue. This is useful since you can modify the buffer size while training the classifier.
- To monitor memory usage, use the
free -mh
command, orwatch -n1 free -mh
to refresh it every 1s.
- What are the exact conditions before a stage is finished? Is time wasted after maxFalseAlarm is hit before the next stage starts?
- The total time elapsed counter is way off. It's showing over 4 hours so far, and it's on stage 4 after 50 minutes.
OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in get...
Delete the params xml file from the previous cascade and try again! If the command line params don't match, it may be looking for files that don't exist.
Training the classifier with a vector file
opencv_traincascade -data classifier -vec positives.vec -bg negatives.txt\
-numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 52\
-numNeg 600 -w 24 -h 24 -mode ALL -precalcValBufSize 1024\
-precalcIdxBufSize 1024