Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Traincascade - still confused about acceptanceRatio

Hello,
i know this was asked already several times but i am still confused about how the acceptanceRatio based on the maxFalseAlarmRate training parameter breaks my model training with showing the message "Required leaf false alarm rate achieved. Branch training terminated"

I also read the book "OpenCV 3 Blueprints" wroten by Joseph Howse,Steven Puttemans,Quan which tells :
The training breaks if the acceptanceRatio < then maxFalseAlarmRate^NumStages

But i can't apply this statement to my training, for example:
I used to detect some arizona bottles using the traincascade with the following parameters:

opencv_traincascade.exe -data data -vec bottle.vec -bg bg.txt -numPos 1000 -numNeg 2100 -numStages 8 -minHitRate 0.995 -maxFalseAlarmRate 0.3 -w 40 -h 100 -featureType HAAR

I got in total:
Pos Pictures: 1071
Neg Pictures: 2165
I trained my cascade about one day ending up with 7 stages because of the break statement:

===== TRAINING 6-stage =====
<BEGIN
POS count : consumed   1000 : 1009
NEG count : acceptanceRatio    2100 : 0.000171474
Precalculation time: 30.145
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|    0.996| 0.447143|
+----+---------+---------+
|   4|    0.999|  0.35381|
+----+---------+---------+
|   5|    0.997| 0.267619|
+----+---------+---------+
END>
Training until now has taken 0 days 23 hours 9 minutes 46 seconds.

===== TRAINING 7-stage =====
<BEGIN
POS count : consumed   1000 : 1012
NEG count : acceptanceRatio    0 : 0
Required leaf false alarm rate achieved. Branch training terminated.

But i still dont understand why it broke the training.
If i take from the parameters maxFalseAlarmRate^NumStages = 0.3^8 this is still bigger than the last given acceptanceRatio : 0.000171474
Did i maybe thought wrong and its maxFalseAlarmRate^CurrentStageDepth= 0.3^7 ?

Although my cascade is very decent in detecting arizona bottles (sometimes 1-2 false positives) and i know it will only detect them at least on the dimensions -w 40 -h 100 but if there are any suggestions to improve my detection parameterwise please feel free to tell me (increasing overall dataset is planned in future)