I adjusted the size of all positive samples to be of same size, so shall negative samples have the same size of positive ones.
-
Are you referring to the relative size of vehicles in your sliding window? – autonomy Jun 07 '16 at 20:51
-
No. the negative images did not contain vehicles. My question is whether the images size should be of the same size. – Elhamshary Jun 09 '16 at 02:12
1 Answers
Generally, with object detection, you are sliding a search window of a fixed size across your image, producing feature responses. The classifier then compares the responses to a trained model and reports the proximity of the two. We are relying on the fact that the same kind of objects will produce similar feature responses. For this reason you want your positive data to be of the same size in each sliding window, otherwise the responses will be different and you won't get good matches.
When you are training on the negative data, you are giving the classifier examples of responses which generally won't have anything in common, this is how the algorithm learns to partition your data. It doesn't really matter what the size of your images because you will be using the same sliding window. What matters is the data captured by that window - it should represent the data you will use at runtime. What I mean is that the sliding window should not contain either too much or to little detail. You don't really want to take a full-landscape photo, reduce it to 320x240 and then train on it. Your sliding window will capture too much information. Same goes for taking a smaller subset of a scene and blowing it up to 1280x960. Now there's too little information.
With all that said, however, things are more complicated and simpler at the same time in the real world. You will encounter objects of different sizes; therefore you need to be able to handle them at different scales. So your classifier should be searching across multiple scales, thus making image sizes irrelevant. Remember, it's what's within the sliding window that counts. And: garbage in = garbage out. Make sure your data looks good.
Edit: http://docs.opencv.org/2.4/doc/user_guide/ug_traincascade.html But each image should be (but not necessarily) larger then a training window size, because these images are used to subsample negative image to the training size.

- 1,165
- 1
- 12
- 18
-
What about the fair amount of images i should use for training ? I already have around 10,000 negative images and around 7000 positive images of the same size and format. What is your thoughts? – Elhamshary Jun 17 '16 at 15:39
-
The short answer is that amount of training data sounds reasonable. The long answer is it depends on what accuracy you're trying to achieve and which operating conditions you're trying to cover. If all you're doing is working on a new feature, then having a smaller, but diverse dataset will help you train faster. If you want high accuracy in different conditions/lighting/angles, you want lots and lots of diverse data - it doesn't help to have 7000 images of the same car (I'm exaggerating) as you'll simply learn to find that particular car and your classifier won't generalize well. – autonomy Jun 20 '16 at 13:28
-
Now, i am changing my mind towards using deep learning for detection, does the size of images matters in deep learning ? – Elhamshary Aug 17 '16 at 07:53