Bad trained cascade in OpenCV

1.2k views Asked by At

I can't train the classifier properly.. When I use the generated cascade.xml the object is not recognized. Instead some parts of the object are.

The command line for training is this:

opencv_traincascade -data data -vec samples.vec -bg negatives.txt -numPos 200 -numNeg 100 -numStages 13 -w 80 -h 80 -featureType LBP -minHitRate 0.999 -maxFalseAlarmRate 0.5

While training the output looks like this:

===== TRAINING 10-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    100 : 0.00586029
Precalculation time: 2
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|     0.09|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 6 minutes 9 seconds.

===== TRAINING 11-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    100 : 0.00724585
Precalculation time: 3
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|     0.09|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 6 minutes 49 seconds.

===== TRAINING 12-stage =====
<BEGIN

And when I use it to detect my object (in my case the object is a steering wheel) the result is: enter image description here enter image description here

1

There are 1 answers

8
blakeO On

You are using too few images as a samples for the image which has a 80x80 dimension. I'd minimize the dimension of the images, meanwhile adding some more samples. Another thing is the set of the negative images. What are you using as a negative samples? Try to enlarge your negative image set by adding this false detected chunks.