# Best Cascade for detecting Mororcycles (side views) [closed]

Hello, I am trying to train cascade to detect motorcycle. I tried LBP (with stage 15) and it's giving too much false negatives, Here is what I did till now,

I recorded required traffic videos . Developed a program to track all moving objects and when it crosses line of detection, cv::imwrite() to save the Rectangular ROI. Manually separated which are Motor Cycles and which are not, cropped them and made sure that the others donot have any motorcycles. Like this I have collected around 257 positive images and 653 negative images (I can get more negatives if required),

If you would like to have a look at the collected data, I have uploaded them here :

It looks like this :

positives :

, , , ,

negatives are cars, trucks, people, etc...

I generated LBP cascade using opencv_traincascade with numStages 15 and 20 . They are giving too much (around 55%) false negatives

I tried to generate HOG cascade using https://github.com/opencv/opencv/blob... , but it requires be to provide samples of fixed sizes , that too 64x128 (which will totally deform my images, I don't think that's going to work) .

By seeing the Images above, could you please suggest some ideas how I achieve my requirement ? Should I try HOG ? HAAR ? LBP ? should I increase/decrease the numStages ?

Your inputs are most valued, Thanks.

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by sturkmen close date 2020-10-10 13:23:55.551616

• you're not training a cascade for motorcycles, you're training one for humans on motorcycles
• if there is so much variance in your images, you'll need far more positives to compensate
• you should not have left facing and right facing ones in the same train set. flip the resp. images, so they all look into the same direction. the resulting classifier will only be able to detect that orientation, you'll have to flip the image in the detection, and do a second one (like it is done with profile faces)

• also consider (re)training an SSD cnn for this (there are also existing ones, which have motorcycles)

( 2018-04-05 00:32:09 -0500 )edit

Why don't you opt for HOG based detector..

( 2018-04-05 07:45:21 -0500 )edit

I would really like to, but I am a beginner, and all the tutorials, the train_HOG.cpp by opencv everything requires me to resize my images to 64x128 .. which I don't think would help because bikes are almost 1:1 aspect ratio. It would be really helpful if some one could direct me to some good resource to learn how to train HOG according to our requirements. Thanks

( 2018-04-05 07:58:04 -0500 )edit

64x128 is not required, you can use any aspect ratio you like, and 64x64 would indeed be a good idea.

( 2018-04-05 08:14:24 -0500 )edit

@berak is right it depends upon what type of stuff you want to find in image....small,tiny or as large as 747.... So nothing to think on scaling.Yes if you want to ask about patch size...then there may be an issue of pixles per patch in image.Well I suggest you to visit here for HOG tutorial.and if you find more problem after visiting tutorial then visit this problem

( 2018-04-05 08:22:41 -0500 )edit

again, the windowsize used for training (for both HOG and cascades) is the minimum size, that can be detected later, so you want to keep it as small as possible

( 2018-04-05 21:28:41 -0500 )edit