Ask Your Question
0

Traincascade - still confused about acceptanceRatio

asked 2017-01-23 08:38:45 -0600

Martin93 gravatar image

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)

edit retag flag offensive close merge delete

Comments

I think you need to add more negative samples to your training set.

Pedro Batista gravatar imagePedro Batista ( 2017-01-23 10:58:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-24 08:25:39 -0600

basically what that message is stating, is given your parameters and your data, our model is strong enough. So basically you need to provide more training data, because changing your maxFalseAlarmRate will make your model overly complex and overfitting to your training data. About the formula, it was grabbed from the original authors submission, but if there is something wrong with it, I might need to recalculate it. Let me take a look at it later this week.

edit flag offensive delete link more

Comments

actually I think you miscalculated ... 0.3 to the power 8 equals 0.00006561 which is in my opinion smaller than 0.000171417. There is an extra 0 and thus it is normal that it breaks!

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-24 08:39:59 -0600 )edit

Hello Steven thanks for the quick answer, you are right i misswrote there.
0.3^8 is smaller than the given acceptanceRatio but im confused based on the statement wrote in "OpenCV 3 Blueprints" that a break occurs if acceptanceRatio < then maxFalseAlarmRate^NumStages
In my case it is maxFalseAlarmRate^NumStages < then acceptanceRatio so why did my training broke in this case.

Martin93 gravatar imageMartin93 ( 2017-01-25 07:47:26 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-23 08:38:45 -0600

Seen: 2,730 times

Last updated: Jan 23 '17