问题
I developed an application for face detection using OpenCVs HAAR cascade face detection. The algorithm works fine, however every once in a while It finds patterns on the wall or ather things that are not faces.
I want to run additional checks on object suspected as faces but I want to do it only on objects that I am not confidant that they are faces. Is there a way to get a "confidence" level for a face detected by the HAAR cascade face detection?
回答1:
OpenCV provides the confidence via the argument "weights" in function "detectMultiScale" from class CascadeClassifier, you need to put the flag "outputRejectLevels" to true
回答2:
OpenCV actually finds more than one result for any particular object, each detected area largely overlapping each other; those are then grouped together and form a 'number of neighbours' count. This count is the so called confidence.
When you perform object detection, one of the parameters is the minimum neighbours before a hit is returned. Increasing it reduces false positives, but also decreases the number of possible detected faces.
回答3:
Why not run multiple haar cascades (trained differently) against the same image and see if they produce similar results? Have them vote, as it were. Thus if only one cascade found a given face and the others didn't, that would give you less confidence in that given face.
I was able to run 3 cascades simultaneously on an iPhone video feed in real-time, so performance shouldn't be an issue in many normal scenarios. More here: http://rwoodley.org/?p=417
回答4:
Not a direct answer to your question, but this may help in reducing false detection.
You can get less false detection by tweaking MinNeibhbours, CV_HAAR_FIND_BIGGEST_OBJECT, and Size values.
int MinNeighbours = 7;
face_cascade.detectMultiScale( frame_gray, faces, 1.1, MinNeighbours, CV_HAAR_FIND_BIGGEST_OBJECT, Size(60, 60) );
来源:https://stackoverflow.com/questions/10530023/is-there-a-way-to-get-a-measurement-of-confidence-level-when-using-haar-face-det