# Open CV traincascade gets stuck with a Hit rate of 1 and a False alarm rate of 0

I want to train a LBP classifier. I have 103 positive and 500 negative samples. I used almost default values, except for -featureType LBP and -numPos 88.

opencv_traincascade -data "$NAME"_Output \ -vec "$NAME".vec \
-bg "\$NAME"_Negative.txt \
-numPos 88 \
-numNeg 500 \
-numStages 20 \
-stageType BOOST \
-featureType LBP \
-w 32 \
-h 48 \
-bt GAB \
-minHitRate 0.995 \
-maxFalseAlarmRate 0.5 \
-weightTrimRate 0.95 \
-maxDepth 1 \
-maxWeakCount 100


The classifier gets stuck at stage 2 after stage 1 got a full hit rate and a zero false alarm rate. I tried playing with the numPos, numNeg, and bt parameters, but it always gets approximately the same result. I also tried a HAAR classifier, it got a little further (stage 4) but it got stuck in the same way eventually.

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   88 : 88
NEG count : acceptanceRatio    500 : 1
Precalculation time: 1
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|    0.046|
+----+---------+---------+
END>

===== TRAINING 1-stage =====
<BEGIN
POS count : consumed   88 : 88
NEG count : acceptanceRatio    500 : 0.0456038
Precalculation time: 0
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        0|
+----+---------+---------+
END>

===== TRAINING 2-stage =====
<BEGIN
POS count : consumed   88 : 88


I don't know enough about this but my guess is that its complete after stage 1, but it still trying to generate 18 more stages. My data set is quite simple, the positive should all be quite similar and the negative images are the same size.

• Is it possible to have a classifier with only 2 stages? (stage 0 and stage 1)
• Are LBP classifiers more tricky to get working than HAAR? Should I stick to HAAR since I am new at this?
• Have I made any mistakes with the parameters or input data?
edit retag close merge delete