0
votes

I am doing a real-time people detection using HOG-LBP descriptor and using a sliding window approach for the detector also LibSVM for the classifier. However, after classifier I never get multiple detected people, sometimes is only 1 or might be none. I guess I have a problem on my classification step. Here is my code on classification:

     label = ones(length(featureVector),1);
     P = cell2mat(featureVector);

     % each row of P' correspond to a window
     % classifying each window
     [~, predictions] = svmclassify(P', label,model); 


     % set the threshold for getting multiple detection
     % the threshold value is 0.7
     get_detect = predictions.*[predictions>0.6];

     % the the value after sorted
     [r,c,v]= find(get_detect);


     %% Creating the bounding box for detection 
     for ix=1:length(r)
         rects{ix}= boxPoint{r(ix)};
     end

     if (isempty(rects))
         rects2=[];
     else
         rects2 = cv.groupRectangles(rects,3,'EPS',0.35);
     end



     for i = 1:numel(rects2)
         rectangle('Position',[rects2{i}(1),rects2{i}(2),64,128], 'LineWidth',2,'EdgeColor','y');
     end

For the whole my code, I have posted here : [HOG with SVM] (sliding window technique for multiple people detection)

I really need a help for it. Thx.

1
What is the output of the 'predictions' array? If all values are 0, then the problem is in the classifier itself (maybe bad training, or bad descriptor extraction).phyrox
The output is the gradient feature values from the descriptor after being classified with the training images in the model. Even until I set the threshold, the output of predictions are still in features values not 0. The one that I might confused is only the bounding box, I guess my method to create the bounding box is not correct. Because it doesnt show me any detected people. Could you help me how to set bounding box from classied data? Thx. @phyroxIndrasyach

1 Answers

2
votes

If you have problems wiith the sliding window, you can use this code:

topLeftRow = 1;
topLeftCol = 1;
[bottomRightCol bottomRightRow d] = size(im);

fcount = 1;

% this for loop scan the entire image and extract features for each sliding window
for y = topLeftCol:bottomRightCol-wSize(2)   
    for x = topLeftRow:bottomRightRow-wSize(1)
        p1 = [x,y];
        p2 = [x+(wSize(1)-1), y+(wSize(2)-1)];
        po = [p1; p2];
        img = imcut(po,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);
% each row of P' correspond to a window
[~, predictions] = svmclassify(P',lebel,model); % classifying each window

[a, indx]= max(predictions);