5

I am currently detecting heads in a CCTV image. I am using a HOG detector + SVM and I am using the sliding window technique to detect the heads. Of course, when I am scaling the image, I am having multiple detection/bounding boxes of the same head. I know that I have to use non-maxima suppression to choose the best one of them, and I have tried to follow the following link: http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html

However, I cannot understand how to get the score for each sliding window. Can someone explain to me please? In other words, I have the bounding boxes pts and I know that I have to set an overlap of 0.5, but I do not have the score for each bounding box.

dynamic
  • 46,985
  • 55
  • 154
  • 231
user2541516
  • 79
  • 1
  • 9
  • 1
    Its the score of prediction given by the classifier, I suppose. For SVM, if you use LibSVM, that score could be the probability estimate which it outputs. The score is the probability that the object (say car) is contained in that box. – Autonomous Nov 01 '14 at 22:16
  • Who is detecting Windows MATLAB, why is it being suppressed, and how is that different from Linux MATLAB or Mac MATLAB? (It seems like the word "MATLAB" is very out of place in your title) – Ben Voigt Nov 02 '14 at 00:03
  • @ParagS.Chandakkar yes after doing some good research I agree with you, infact I used the parameter 'b 1' to output the probabilities. However when outputting the probabilities on the console, I noticed that for each prediction 2 probabilities were given instead of 1. Can I clear this out with you please? Thanks a lot – user2541516 Nov 02 '14 at 15:36
  • There are two probabilities. One is for class 0 and other is for class 1. Both will sum to one. You can check. – Autonomous Nov 02 '14 at 23:18
  • Brilliant, I have 2 classes +1 and -1 which represent a head and a non-head respctively. So regarding the score for the NMS, which probability should I choose please? Thanks for your assistance @ParagS.Chandakkar – user2541516 Nov 03 '14 at 00:20
  • If your class +1 means -> head is detected, then you should choose that probability. – Autonomous Nov 03 '14 at 00:44
  • Thank you very much @ParagS.Chandakkar you were of great help :) – user2541516 Nov 03 '14 at 16:19
  • Yes @ParagS.Chandakkar because I figured it out myself. I am currently using the score as you told me and applying it to the NMS found in this link http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html. However when I am applying it, the bounding boxes became really huge when compared to the head. Is it normal or am I doing something wrong please? – user2541516 Nov 03 '14 at 20:49
  • I don't think it is normal. However, NMS is just going to select the strongest box out of *available* boxes. So, in the first place, if you are receiving a high score for a big box, that is mistake in the feature computation-classifier pipeline. NMS can't do anything about it. If you are generating boxes exhaustively, I would suggest you switch to some intelligent methods such as [this](http://www.philkr.net/home/gop) or [this](http://research.microsoft.com/en-us/downloads/389109f6-b4e8-404c-84bf-239f7cbf4e3d/). – Autonomous Nov 03 '14 at 21:10
  • @ParagS.Chandakkar Thanks again. However, I am not sure with what you mean by "generating boxes exhaustively". In my case for each sliding window I try to predict with my model. If it is a head I draw a bounding box on the image, else do nothing. – user2541516 Nov 03 '14 at 21:28
  • If you are using sliding window then yes, you are generating all possible (i.e. exhaustive) combinations of the *possible* head positions. I don't think its the NMS' fault to give you a high score for a large box. If you use some intelligent methods I mentioned above, you may reduce your boxes (as in you don't have to use a sliding window), which reduces the chances of classifier making a mistake. – Autonomous Nov 03 '14 at 21:59
  • Ok. I will try them thanks. Btw stackoverflow is telling me to prevent continuing conversations in comments. Is there a possible way how I can contact you or maybe chat with you regarding such issues. Thank you very much. You are of great help. – user2541516 Nov 03 '14 at 22:19

2 Answers2

5

Actually for non-maximum suppression you don't need the score associated to each bounding box. You can use the well-known NMS method of Viola and Jones (Boosted cascade of simple features):

  • cluster all bounding box that have overlap with each other greater than 0.5
  • for each cluster calculate the mean bounding box and output it (that is calculate the mean point between all top right corners and all bottom-right corners)

And you have non-maximum suppression.

If you still want to use other routines that require output scores, then just assign to each bounding box the same score.

dynamic
  • 46,985
  • 55
  • 154
  • 231
  • I will be trying the way you are telling me and let you know with the result @dynamic – user2541516 Nov 02 '14 at 15:37
  • 1
    I tried to use nms shown in this link: http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html by giving each bounding box the same score of 1, but the resulting boxes became very huge when compared to the small ones, thus instead of capturing the head, each box is capturing the head + many other things with it...any feedback? – user2541516 Nov 03 '14 at 16:20
  • @dynamic Can you define what overlap means and how the clustering is carried out? – warmspringwinds Jul 07 '15 at 18:39
2

You should be able to get a score out of the SVM. For example, if you train the SVM using ClassificationECOC class in the Statistics Toolbox, its predict method can return the score.

Then you can use the selectStrongestBbox function in the Computer Vision System Toolbox to do non-maxima suppression.

Dima
  • 38,860
  • 14
  • 75
  • 115
  • Great @Dima however I was trying to use the nms from the following link : http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html – user2541516 Nov 03 '14 at 15:31
  • I am also using HOG features with libSVM on MATLAB..and I am trying to suppress unwanted bboxes by using the nms shown in the link of the comment above – user2541516 Nov 03 '14 at 16:24
  • 1
    @user2541516 This function seems to do what you want to. So do you just want to implement NMS by yourself, if so, then go ahead. Otherwise, I think `selectStrongestBox` does what you want to. – Autonomous Nov 03 '14 at 21:12
  • Thank you v.much. Just as part of curiosity when it comes to training the model should the negative images sometimes include half the positive images. For example in my case should some of the negative images contain half a head and half the background? – user2541516 Nov 03 '14 at 23:09