How to train a CascadeClassifier to detect object with different aspect ratio?

asked 2016-04-21 04:17:17 -0600

igor gravatar image

updated 2016-04-22 04:11:07 -0600

I tried to detect object which could have different aspect ration in the positive photo.

I used the next params: opencv_traincascade -data haarcascade -vec samples.vec -bg negative.dat -numStages 15 -minhitrate 0.99 -maxFalseAlarmRate 0.4 -numPos 797 -numNeg 933 -w 15 -h 30 -mode ALL -precalcValBufSize 2048 -precalcIdxBufSize 2048

So, aspect ratio is 1:2 in the image pattern.

And when I use a generated cascade.xml I can detect an object in the pictures only with the similar aspect ratio. But some photos contains objects with 2:3 or even 1:1 ratio.

How can I detect these objects?

edit retag flag offensive close merge delete

Comments

2

Edit: CascadeClassifier is not a neural network, it is a cascade of classifiers (obviously)

LorenaGdL gravatar imageLorenaGdL ( 2016-04-22 02:29:08 -0600 )edit
1

You can't. Best approach, take images as training of different ratios and transform them to an average ratio. That has worked for me for slight deviations in ratio. If the ratio changes drastically, you need seperate detectors build for different ratios!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-04-22 06:39:59 -0600 )edit