All my questions about opencv_traincascade

1.8k views Asked by At

it's some weeks that I try to create a good cascade classifier but it seems that this process is surrounded by mystery. I have a lot of questions:

1) Why opencv give us so little information?

2) It needs more positive images or negative images?

3) What size should have positive images? And negative images? They must have all the same size?

4) if I want to create a classifier for a single road sign is enough a single positive image like this to create samples with opencv_createsamples?

5) To create a classifier used on an android app is better Haar or LBP?

6) what is the right number of stages?

7) What is the right value for minHitRate and maxFalseAlarmRate?

1

There are 1 answers

7
Dabo On BEST ANSWER
  1. It gives information, it is just a bit borring to read it http://docs.opencv.org/doc/user_guide/ug_traincascade.html
  2. You need more negative images, for several reasons. First it just sometimes crashes when there more positive images then negative, second - most of the time training is focused on looking in negative images for something that was detect as your object and fixing the mistake.
  3. As far as i know, it does not matter that much, but what is relevant is the negative images them self. They should be close to the real backgrounds of your object, i mean if it is a traffic sign don't give pictures clicked in your office as background, take pictures clicked outside.
  4. For me it was enough to have one picture of my object, to generate 1500 samples with opencv_createsamples, but much better to have several images 10, 20 to generate 100, 200 samples with each and then combine it all into one training set.
  5. Haar is slower training and runtime, but sometimes it is more precise, so my choice is LBP.
  6. You can train cascade stage by stage, to make 10 -15 stages at the beginning, and then add them one by one.All stages recorded, and you don't have to begin each time from stage one.

7.I did not play with this parameters, i always leave them with defaults but you can check here about traincascade paremeters, samples, and other... for explanations.

Also check this question and answer How to train cascade properly and FAQ - HAARTraining