catcierge-samples

Created: 2014-05-18 22:06
Updated: 2015-10-22 08:28
License: gpl-2.0

README.md

catcierge-samples

Catcierge project samples for Haar cascade classifier

Description

The positive images marked in positives.txt were marked using: imageclipper

This list of positives where then fed to the Opencv createsamples program:

$ /path/to/opencv_createsamples -vec catcierge.vec -info positives.txt -bg negatives.txt -num 2588

It turns out the manual for the OpenCV traincascade program isn't very verbose on what parameters are exactly.

This question on stackoverflow gives the answer on what the -numPos setting actually can be set to.

Just because your .vec file contains 2588 positive samples, doesn't mean you set this to 2588. Instead you need to use this formula:

vec-file has to contain >= (numPos + (numStages-1) * (1 - minHitRate) * numPos) + numNeg

Which in my case is:

2588 >= (x + (20-1)*(1-0.999)*x) + 2279
x <= ~302

So to train the haar cascade:

$ /path/to/opencv_traincascade -vec catcierge.vec -bg negatives.txt -numPos 302 -numNeg 2279 -minHitRate 0.999 -numStages 20 -precalcIdxBufSize 6144 -precalcValBufSize 3072 -w 24 -h 24 -bg negatives.txt -data cascade

Note! Make sure you don't specify more memory than you have available in the above commandline. My computer has 16GB.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more