Ask Your Question

image questions in regards to training cascade classifier

asked 2019-03-20 01:07:39 -0500

wgb-2019 gravatar image

So far I have created two LBP classifiers that do a decent job of identifying the shapes I need identified however, I would like to increase the accuracy and I have the following questions:

  1. Should all the positive and negative images be of the same size? i.e. 64 x 64 or 32 x 64 etc...
  2. If #1 is a no, do all the positive images or all the negative images have to be the same size or ratio?
  3. Should the positive image be cropped to only include what I am looking for or should it have some background ?
  4. Should the negative image be totally different (ex: out of context) from the positive or should it be similar (ex: display the background but not the positive image)
  5. Are there any rules of thumb on how many images I should use. So far I have used 1000 positive and 1000 negative.
  6. Does image orientation play any role i.e. left to right vs right to left?

Thanks in advance WGB

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-03-20 01:48:30 -0500

berak gravatar image
  1. no

  2. no, again. you have to give the desired positive size to the createsamples tool, and make an annotation txt file with image / object rects (to be cropped later), e.g. using the annotation tool fom the apps. again, both positive and negative images can have arbitrary size

  3. no, the createsamples tool will do that for you

  4. you need a realistic background (it has too learn that, too !)

  5. the more, the better. (don't try with 50 only)

  6. yes. you can vary the pose, say, +- 20%, but if you need a detection from the right, and also a detection from the left, you need to traiin 2 seperate classifiers

have a look at the docs, it's all explained there !

last: it's 2019 now, and you probably should retrain a (SSD style) cnn for your purpose. the cascades are somewhat "on the way out" , e.g. latest opencv does no more contain the tools to train those.

edit flag offensive delete link more


The reason I choose LBP is due to its speed. I need to scan around 450 frames (300 fps) and extract the results almost in real time. How fast are CNN's?

wgb-2019 gravatar imagewgb-2019 ( 2019-03-20 02:20:43 -0500 )edit

yea, good luck. just be aware of it's limitations, and, that code for this might not be maintained in the future.

berak gravatar imageberak ( 2019-03-20 02:28:23 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-03-20 01:07:39 -0500

Seen: 32 times

Last updated: Mar 20