1

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

dephinera
  • 3,703
  • 11
  • 41
  • 75

1 Answers1

2

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.

blakeO
  • 489
  • 1
  • 5
  • 6
  • Really, thank you very much for your answer. As a negative samples I use anything but my object. Thank you for your advise, I'll follow it and I hope it will work. Is this object to complicated to be recognized or I just have to train the cascade properly? – dephinera Nov 29 '14 at 09:46
  • FYI, dimension is not important. viola jones method downscales the samples to 24x24 and grayscale them before training. – baci Nov 29 '14 at 11:58
  • If you look at the question you'll see that I use the LBP featureType which is not the viola jones method. – dephinera Nov 29 '14 at 13:11
  • So, @canberk do you have any suggestions what to do? – dephinera Nov 29 '14 at 14:44
  • using 20000 negative samples instead of 100 would be good start. the thing with negative samples is adaboost depends (shapes up) highly on them. haar like features - viola jones - would be another enhancement because of increased (floating point) resolution. – baci Nov 29 '14 at 15:06
  • by the way, boosted cascade is not rotation invariant; you may need to search for the pattern in all rotations as a post processing step – baci Nov 29 '14 at 15:08
  • I have over 2K negative samples but less than 200 positive. Should I use opencv_createsamples to create more samples for each of my positive images? – dephinera Nov 29 '14 at 23:01
  • @Crash-ID, if this 200 images are only strait samples of your positive images You can add rotations as well to your dataset. Try to set the background image the natural background as it has. And as to complexity of the image, the background the the positive images in case of wheel are not so obviously separated. So for the beginning try just to enlarge your set, adding rotations, and also the negative set. And see if You will get any improvement or not. These have to be your initial steps. – blakeO Dec 01 '14 at 05:20