Ask Your Question

Revision history [back]

First of all your command is full of typos and abundant slashes. It should be

opencv_traincascade -data classifier/ -vec samples.vec -bg negatives.txt -numstages 20 -minHitRate 0.999 -numPos 1000 -numNeg 600 -maxFalseAlarmRate 0.5 -w 80 -h 40 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024

Secondly, if you have a vec file of 1000 elements but only 50 positive images, can you give the command on how you created the vector? As far as I see this is not possible unless you used the warping functions which is a very bad approach. Also keep in mind that the algorithm can reject positives so it will probably fail anyway in the second or third stage.

Also negative images can contain multiple image patches size of your model. So basically you can ask for more patches than there are images.

I suggest changing the command to the following, if your vector data is correct.

opencv_traincascade -data classifier/ -vec samples.vec -bg negatives.txt -numstages 20 -minHitRate 0.999 -numPos 850 -numNeg 2000 -maxFalseAlarmRate 0.5 -w 80 -h 40 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024

But keeping a minHitRate of 0.999 will be quite difficult. That allows almost no misclassification!