What is the posible reason of "Required leaf false alarm rate achieved. Branch training terminated."
The folowing command for training:
for creating samples
-img imgs/CHE_one_wb.jpg -num 300 -bg imgs/negat.dat -vec imgs/vector.vec -info imgs/smpl/info.txt -maxxangle 0.1 -maxyangle 0 -maxzangle 0.1 -maxidev 100 -bgcolor 255 -bgthresh 0 -w 20 -h 35
-img imgs/CHE_one_wb.jpg -num 300 -bg imgs/negat.dat -info imgs/smpl/info.txt -maxxangle 0.1 -maxyangle 0.1 -maxzangle 0.1 -maxidev 100 -bgcolor 255 -bgthresh 0 -w 20 -h 35
for train
-data imgs/cascade/ -vec imgs/vector.vec -bg imgs/negat.dat -numPos 200 -numNeg 40 -numStages 10 -featureType LBP -maxFalseAlarmRate 0.9 -w 20 -h 35
RESULT OF TRAINING
I have achieved my goal and trained good cascade.
0.000412662
or less. But if you get acceptanceRatio like this 7.83885e-07
your cascade is probably overtrained and it wont find anything, try to set less stages.
!!! And one more important thing, when you train your cascade you should have more than one feature on your stage beginning from 2 or 3 stage. If you have only one feature you wont get good cascade. You should work on your training images (negative and positive samples). Normal training will look like this:
For training I have used -data imgs/cascade/ -vec imgs/vector.vec -bg imgs/negat.dat -numPos 1900 -numNeg 900 -numStages 12 -featureType HAAR -minHitRate 0.999 -maxFalseAlarmRate 0.5 -w 24 -h 30
command
Both features types work almost equals sometimes HAAR is a little bit better but it is significant slower than LBP.
Number of negatives are too little comparing to number of positives and number of stages.
If you have a small number of data, you need less number of stages to achieve the required false alarm rate you set up. This means that the cascade classifier is "good enough" so it doesn't have to grow further. The total false positive ratio is actually multiplied by every stage's ratio, so after a point, the value is achieved.
In your options you set it up to 0.9. Consider making it higher, like 0.95 or more.
Apart from that, your datasets are small, so it's easier for the algorithm to get good results when validating on them during training. The smaller the dataset, the easier for the classifier to be trained, so less stages are required. But this doesn't mean that it's better when running on real data. Also, if you keep the training size low and set a higher ratio, consider that the classifier will need more stages to finish and will be more complicated, but it's very possible that it will be over-trained on the training set.
To conclude, if the nature of your positive and negatives that you have, is making them easy to seperate, then you don't need so many samples. Of course that depends on what you are training the algorithm for. With your amount of samples, the 10 stages you put are a lot, so the algorithm terminates earlier (it's not necessarily bad).
When I was training faces, I think I had around 1 thousand of positive (including all the rotations/deviations) and 2-3 thousands of negatives, to need a classifier of around 11-13 levels, if I remember correctly.
The tutorial of Naotoshi Neo had helped me a lot.
Also, what I noticed now, as Safir mentioned, you have too few negative samples comparing to the positive ones. The should be at least equal in number, preferably around 1.5 - 2 times more than the positives.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With