Ask Your Question
0

Infinite loop in Haar, LBP, HOG in opencv traincascades

asked 2014-03-18 11:16:17 -0600

aishpant gravatar image

I have asked the same question on stackoverflow. I am trying to build a classifier to detect faces in Thermal images. So I tried training using Haar, LBP and HOG classifiers. I am working with OpenCV 2.4.8 on windows.

opencv_traincascade.exe -data haarcascades -vec pos.vec -bg neg.txt -numPos 250 -numStages 24 -numNeg 900 -w 24 -h 24

I have 307 positive samples in total. The negative samples are of size 75x75. For each of the three cases the training gets stuck at a particular stage-earlier for Haar (stage-12) and later for LBP (stage-14/15). I reduced the number of negatives (upto 200) but that means the training gets stuck at a later stage. The training hasn't progressed since 2 days. No negatives are being consumed and the command window looks like this-

===== TRAINING 14-stage =====
<BEGIN
POS count : consumed   255 : 262

Also-What do POS count consumed and NEG count consumed signify? When I reduce the minHitRate to say 0.7 why do the number of POS consumed increase?

Please let me know what I am doing wrong. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2014-03-18 23:51:01 -0600

a)numPos < number of samples in vec

b)choosing minhitrate and maxfalsealarm

For example you have 1000 positive samples. You want your system to detect 900 of them for training. So desired hitrate = 900/1000 = 0.9. Commonly, put minhitrate = 0.999^number of stages

For example you have 1000 negative samples. Because it’s negative, you don’t want your system to detect them. But your system, because it has error, will detect some of them. Let error be about 490 samples, so false alarm = 490/1000 = 0.49. Commonly,put false alarm = 0.5^number of stages

c)vec-file has to contain >= (npos + (numStages-1) * (1 – minHitRate) * numPose) + S, where S is a count of samples from vec-file.S is a count of samples from vec-file that can be recognized as background right away.

d)The more the number of negative images,more the traincascade uses the samples to train every step.I wont day you should reduce the number of negative images but keep it optimal.

e)I am not perfectly sure but Pos Count consumed gives the number of positive images you mentioned to use for train : number of random images it took from vec file to choose the required number you mentioned.The neg count consumed specifies the ratio of negative images that got used in the process of false training in that particular stage.Please verify this once.

Hope this helps you :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-18 11:16:17 -0600

Seen: 926 times

Last updated: Mar 18 '14