用于多人检测的HOG描述符



我正在使用HOG-LBP描述符进行实时人员检测,并使用滑动窗口方法作为检测器,使用LibSVM作为分类器。然而,在分类器之后,我从来没有得到多个检测到的人,有时只有1或可能没有。我想我的分类步骤有问题。下面是我的分类代码:

     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

对于我的全部代码,我张贴在这里:[HOG with SVM](多人检测的滑动窗口技术)

我真的需要一个帮助。Thx .

如果滑动窗口有问题,可以使用以下代码:

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);

最新更新