2
votes

I am trying to create a object detection SVM that can detect remote control calls rolling slowly on the floor. i am using HOG cpp script in matlab (via mex) and the SVM-Light library (http://svmlight.joachims.org/)

i was wondering how i could go about detecting the cars if they are closer to the camera (i know that i need to have different sized windows im just not sure how to implement it) and how to tell SVM not to detect anything if it cannot see a car.There will only be one car in the frame at all times. I am using a Matlab 2012a. I was also wondering on how to speed up the Sliding window algorithm and also was wondering if the size of the training images will affect the results dramatically.

here is my sliding window code

[bottomRightCol bottomRightRow d] = size(im);

fcount = 1;

for y = 1:bottomRightCol-wSize(2)    
    for x = 1:bottomRightRow-wSize(1)
        img = imcut([[x,y]; [x+(wSize(1)-1), y+(wSize(2)-1)]],im);      
        featureVector{fcount} = HOG(double(img));
        boxPoint{fcount} = [x,y];
        fcount = fcount+1;
        x = x+1;
    end
end

lebel = ones(length(featureVector),1);
P = cell2mat(featureVector);
[~, predictions] = svmclassify(P',lebel,model);
[a, indx]= max(predictions);
bBox = cell2mat(boxPoint(indx));
rectangle('Position',[bBox(1),bBox(2),wSize(1),wSize(2)],'LineWidth',3, 'EdgeColor','r');

sorry about all the questions but any help or advice would be greatly appreciated

Cheers :D

1
To accommodate for multiple sizes, it is always customary to look for your object in a scale space. You keep the size of the window the same, but you search for the object over multiple scales of your image. This accommodates for multiple object sizes. As such, you would introduce training patches of multiple sizes in a scale space to accommodate for this. You would also do the same kind of searching when you're detecting the object. Scale space is used in many paradigms: Feature Detection (SIFT, SURF), Wavelet Decomposition, Filtering, etc.rayryeng
from my understand i thought that a SVM was only able to to take one size of training image? how could you go about getting the SVM to receive multiple sizes of a image?user3774031
If you take a look at the link, you scale down the image, blur it, then scale it back. For the next scale, you keep this blurred result from the previous scale, scale that down, then scale it back to the original image size. Realistically, the scale space is created so that all of the images are the same size. However, by progressing downsampling, and upsampling back to the same size as the image, you are effectively creating a scale space of different sized images. Therefore, your SVM training will essentially be working for image of the same size, but multiple scales!rayryeng

1 Answers

0
votes

The Computer Vision System Toolbox lets you train a cascade object detector The cascade object detector also uses the sliding window approach, but it uses a cascade of boosted classifiers, rather than an SVM. Also, you would need a more recent version of MATLAB, because this functionality is not available in R2012a.

You can also try a different approach. If your camera is stationary, you can detect moving objects (your cars) using background subtraction. The Computer Vision System Toolbox includes the vision.ForegroundDetectorObject, which is available in R2012a.