TrainCascade stuck on getting new negatives

asked 2014-01-31 11:34:53 -0600

I'm working with OpenCV 2.4.7 on windows. I'm using TrainCascade to train a new Haar cascade for eyeglasses using the following command:

opencv_traincascade -data trainCascade20 -vec vector3.vec -bg infofile3.txt -numStages 40 -minHitRate 0.999  maxFalseAlarmRate 0.5 -numPos 170 -numNeg 1000 -w 20 -h 20 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024

It's stuck (or progressing very slow) on stage 24 on the phase of getting new negatives. The negative images file "infofile3.txt" contains about 12K negative image.

Can someone please explain why it's progressing so slowly and what can I do make it progress (a lot) faster?

Thanks in advance,

Gil.

edit retag flag offensive close merge delete

Comments

In higher stages it is harder to select new negatives. For 24th stage probability that a negative window will be selected is 24^maxFalseAlarmRate. Sadly, the process of selecting negatives is not parallelized and it can take hours or days to finish.

mada gravatar imagemada ( 2014-05-13 01:22:33 -0600 )edit

Thanks @mada !

GilLevi gravatar imageGilLevi ( 2014-05-13 03:43:17 -0600 )edit

@mada it means that if the stage is 9th and maxFalseAlarmRate is 0.5,the the probability is 9^0.5 = 3 ,which is not possible, since probability > 1. Please help me.

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-08-09 17:46:02 -0600 )edit

The probability is 0.5^9.

mada gravatar imagemada ( 2014-09-12 08:14:42 -0600 )edit

I am suffering from the same problem,you can check my parameters below,the grabbing of negative samples decreases significantly when training the 4th stage (it can only grab around 8000 negatives in 24 hours),what can i do to make it grab faster?I have already tried offering a rich negative dataset with loads of images and it did not help much,instead when i supplied just 1 image in the -bg file the negative grabbing rate increased surprisingly and unexpectedly?!

opencv_traincascaded.exe -data classifier -vec samples.vec -bg negatives.txt -numPos 137 -numNeg 1250000 -numStages 4 -numThreads 4 -featureType LBP -w 50 -h 50 -minHitRate 1 -maxFalseAlarmRate 0.025

can gravatar imagecan ( 2016-04-13 08:16:09 -0600 )edit