Ask Your Question
0

traincascade's error (Required leaf false alarm rate achieved. Branch training terminated.)

asked 2016-01-21 09:58:54 -0600

table234 gravatar image

updated 2016-01-22 06:02:13 -0600

Hello, everyone.

I wamt to create a LBP face detector with traincascade. However, traincascade outputs a following message and stop training. "Required leaf false alarm rate achieved. Branch training terminated."

This is my first training parameters. opencv_traincascade -numPos 7500 -numNeg 3000 -featureType LBP -mode ALL -numStages 12 -w 48 -h 48 However, Training stops stage 9.

I tried to set various parameters. For example, -maxFalseAlarmRate 0.4 or 0.3, -w 24 -w 24, -minHitRate 0.7, -numStage 8 and -numpos 6000 ,but traincascade outputs same error message.

I prepare about 8,500 positive samples and 4,000 negative samples, so I think number of samples is enough. This is a example of positive samples. C:\fakepath\sampling_succeed.png This is a example of negative samples. C:\fakepath\division_img00010.jpg

I have no idea to finish training. Please advice me.

This is reported accuracy at stage 7,8 and stopped 9

===== TRAINING 7-stage =====
<BEGIN
POS count : consumed   7500 : 7659
NEG count : acceptanceRatio    3000 : 0.00111988
Precalculation time: 4.987
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3| 0.998133|    0.633|
+----+---------+---------+
|   4|   0.9968|     0.54|
+----+---------+---------+
|   5| 0.995867| 0.298333|
+----+---------+---------+
END>
Training until now has taken 0 days 1 hours 34 minutes 5 seconds.

===== TRAINING 8-stage =====
<BEGIN
POS count : consumed   7500 : 7690
NEG count : acceptanceRatio    3000 : 0.000370415
Precalculation time: 5.016
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3| 0.997467| 0.585667|
+----+---------+---------+
|   4|   0.9952| 0.478333|
+----+---------+---------+
END>
Training until now has taken 0 days 1 hours 53 minutes 53 seconds.

===== TRAINING 9-stage =====
<BEGIN
POS count : consumed   7500 : 7726
NEG count : acceptanceRatio    3000 : 0.000193578
Required leaf false alarm rate achieved. Branch training terminated.
edit retag flag offensive close merge delete

Comments

Actually with a reported acceptanceRatio of 0.000193578 I would say, try out your detector and create precision recall curves of your application to see how good you are doing. Because I would never train further than 10e-5 because then you get the chance of overfitting to the training data.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-01-22 06:28:45 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-01-21 12:30:20 -0600

updated 2019-09-04 02:58:22 -0600

This is not an error! Given the samples presented and the settings of the training, your cascade has reached its desired potential. Either add more data OR make your requirements harsher! For now it just states, does as good as you requested...

Update 1

So lets make it more clear. When setting up a cascade classifier training using your command opencv_traincascade -numPos 7500 -numNeg 3000 -featureType LBP -mode ALL -numStages 12 -w 48 -h 48 most of the deciding parameters are selected automatically.

For example

-minHitRate is set to 0.995 by default and -maxFalseAlarmRate is set to 0.5 by default. This means that for your current model, you allow 5 out of 1000 positive samples to get wrongly classified during the training process, whereas each stage needs to reach a individual false acceptance rate (good classification of negatives) that is a bit better than random guessing, symbolized by 0.5 value.

So try one of the following things

  1. Change -minHitRate to 0.998 for example and make it harder to reach your goals. However this is not the best approach, since you force your model to overfit to the training data.
  2. Change -maxFalseAlarmRate to for example 0.3, which forces individual stages to be more complex. This is what I suggest if you dont want to add data.

But like being suggested, best thing is to add more discriminative training data to the process. Just to be curious, what is the reported accuracy (value reported after the negative image grabbing) of your model at stage 9?

edit flag offensive delete link more

Comments

Mr.Puttemans Thank you for your advice. However, I don't know how to make requirements harsher.(I do not know "requirements harsher".) Please, show me examples of requirements harsher or references. Sorry.

table234 gravatar imagetable234 ( 2016-01-21 12:54:27 -0600 )edit

@Balaji R, that is not completely true. Adding more positive and negative samples is indeed an option, but there are more options than that. Let me update the answer.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-01-22 03:12:55 -0600 )edit

I also have the same problem.There are 227 positive images and 279 negative images

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-11 02:37:34 -0600 )edit

Please open a specific topic on your problem, so we can address everything there.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-11 03:14:27 -0600 )edit

Sr. My account is not enough karma

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-11 03:58:28 -0600 )edit

should be fine now

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-11 13:02:52 -0600 )edit
1

Hi , I have the same problem. So you are saying that it is not an error and my cascade will work fine???

Amin gravatar imageAmin ( 2018-01-25 04:13:12 -0600 )edit

@StevenPuttemans "Change -maxFalseAlarmRate to for example 0.7, which forces individual stages to be more complex. This is what I suggest if you dont want to add data." Why is increasing the FA rate will make it more complex? Or do you actually mean lowering the FA rate?

Sean_Ng gravatar imageSean_Ng ( 2019-09-04 02:41:43 -0600 )edit

You are hitting the nail there ... since it is indeed the max allowed FArate, it should be lower to be more strict, and thus get more complex. If you increase it, it gets actually more loosy and less strict.

StevenPuttemans gravatar imageStevenPuttemans ( 2019-09-04 02:56:58 -0600 )edit
0

answered 2020-03-29 05:55:55 -0600

ComputerVisionary gravatar image

The training parameter setting is completely wrong. Take a look here to understand how the exponential decreasing of the negative sample factor should be handled: http://www.vision-ary.net/2015/03/boo...

It's applied to faces but it works for every rigid object.

Regards

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-01-21 09:58:54 -0600

Seen: 15,185 times

Last updated: Mar 29 '20