Ask Your Question
0

Required leaf false alarm rate achieved. Branch training terminated.

asked 2013-05-28 20:14:52 -0600

FredJiang gravatar image

updated 2013-05-28 21:44:16 -0600

I use these commands:

  1. find ./negatives/ -name '*.jpg' > negatives.dat

  2. opencv_createsamples -img object.png -num 3000 -bg negatives.dat -vec samples.vec -maxxangle 0.3 -maxyangle 0.3 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 20 -h 20

  3. opencv_traincascade -data haarcascade -vec samples.vec -bg negatives.dat -numPos 10 -numNeg 3000 -numStages 2 -w 20 -h 20 -minHitRate 0.7 -maxFalseAlarmRate 0.6 -mode ALL

negative images are from http://tutorial-haartraining.googlecode.com/svn/trunk/

object image is image description

the result is

===== TRAINING 1-stage =====

POS count : consumed 10 : 10

NEG count : acceptanceRatio 3000 : 0.000429487

Required leaf false alarm rate achieved. Branch training terminated.

now, I have no idea how to resolve this problem, need help.

answers from stevenputtemans

  1. Next time create your own topic

  2. Try upping your minHitRate and lower the maxFalseAlarmRate, basically values of 0.99 and 0.5 are used.

  3. Try creating negatives without the createsamples tool, the rotation and deviation parameters create unreal samples, which create very bad detector classes.

I follow point 2 and use command "opencv_traincascade -data haarcascade -vec samples.vec -bg negatives.dat -numPos 10 -numNeg 3000 -numStages 2 -w 20 -h 20 -minHitRate 0.99 -maxFalseAlarmRate 0.5 -mode ALL", but the result is "Required leaf false alarm rate achieved. Branch training terminated." too.

As for point 3, without createsamples tool, how should I create sample.vec file?

edit retag flag offensive close merge delete

Comments

Did you resolve this issue?

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-11 00:05:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-05-29 01:18:15 -0600

IF this code is exactly as implemented, you have a wrong parameter. NumStages is assigned 2. Knowing it starts at stage 0, it is actually perfectly normal to stop at that criteria. Try upping NumStages to 20 for example.

edit flag offensive delete link more

Comments

I have changed the parameter numStages to 20, but the result is not what I want either. The command and logs are as follows:

command: opencv_traincascade -data haarcascade -vec samples.vec -bg negatives.dat -numPos 10 -numNeg 3000 -numStages 20 -w 20 -h 20 -minHitRate 0.99 -maxFalseAlarmRate 0.5 -mode ALL

logs: maxWeakCount: 100 mode: ALL Stages 0-1 are loaded ===== TRAINING 2-stage ===== <BEGIN POS count : consumed 10 : 17 NEG count : acceptanceRatio 3000 : 1.12322e-06 Required leaf false alarm rate achieved. Branch training terminated.

The frustrating thing is I have not run command opencv_traincascade successfully. Could you give me a runnable example?

FredJiang gravatar imageFredJiang ( 2013-07-04 20:36:37 -0600 )edit

You have only 10 positive elements, which leads to perfectly normal behaviour of stopping at a second stage. This means that your cascade needs only 3 weak classifiers to successfully divide your positive and negative training set. However, a cascade with 10 positive samples will almost never be a good classifier, since you train it way to specific for those samples. This problem is called overfitting your model. I would suggest you go read some more documentation on cascade classification. I have the feeling you do not understand the actual algorithm behind the code.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-05 02:39:32 -0600 )edit

Question Tools

Stats

Asked: 2013-05-28 20:14:52 -0600

Seen: 11,499 times

Last updated: May 29 '13