First time here? Check out the FAQ!

Ask Your Question
1

Control senstivity of object detector

asked Jan 22 '13

rohitg gravatar image

I wanted to analyze the in-built object detector in opencv (CascadeClassifier, using Haar or Hog features). Is it possible to control the false positive or hit rate of the classifier? I would ideally like to plot an ROC or DET curve of the same.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jan 22 '13

Siegfried gravatar image

Hi, in case of HoG you can vary the hit_threshold and group_threshold parameters of the detectMultiScale method to control the number of false positives and true positives.

From the opencv documentation gpu::HOGDescriptor::detectMultiScale (the CPU HoG documentation is currently missing, its a bug in the OpenCV documentation. But the GPU HoG has a quite similar interface so we can look a this one).

hit_threshold - Threshold for the distance between features and SVM classifying plane

group_threshold - Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See groupRectangles())

In my project I am using MeanShiftGrouping=true. MeanShiftGrouping combines the detected rectangles and weights of the detected objects into one result. So we get an resulting rectangle and weight. This weight can be "threshold-ed" by using group_threshold. For the DET diagram in my project I am using therefore a small value for hit_threshold and vary then the group_threshold.

If you use the DET or ROC plot to find the "best" parameter setting for your application you should vary both, the hit_threshold and the group_threshold.

Preview: (hide)

Comments

Thanks! that works. I also found a sample code for HoG in opencv/samples/cpp/peopledetect.cpp Can a similar setting be done for HAAR classifier?

rohitg gravatar imagerohitg (Jan 22 '13)edit

Hi, take a look at the paper from Viola and Jones http://research.microsoft.com/~viola/Pubs/Detect/violaJones_IJCV.pdf at figure 6 on page 12. The detection cascade looks like an unbalanced decision tree. At every layer a classifier is used to reject wrong hypotheses. Probably you can use the search depth in the decision tree as a kind of "weight". The CascadeClassifier::runAt() method provides this information (see http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html?highlight=haar#cascadeclassifier-runat)

Siegfried gravatar imageSiegfried (Jan 22 '13)edit

Question Tools

1 follower

Stats

Asked: Jan 22 '13

Seen: 1,333 times

Last updated: Jan 22 '13