Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get a measurement of confidence level when using haar face detection using OpenCV?

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?

like image 872
Itay k Avatar asked May 10 '12 08:05

Itay k


People also ask

How accurate are Haar Cascades?

By using Equation (3) Accuracy is obtained for the Haar cascade is 96.24% and for LBP classifier 94.74%.

How does Haar cascade classifier work in face recognition?

So what is Haar Cascade? It is an Object Detection Algorithm used to identify faces in an image or a real time video. The algorithm uses edge or line detection features proposed by Viola and Jones in their research paper “Rapid Object Detection using a Boosted Cascade of Simple Features” published in 2001.

How do you use Haar cascades for detecting things in an image?

Loading Haar Cascade in OpenCV We can load any haar-cascade XML file using cv2. CascadeClassifier function. Once cascade is loaded in OpenCV, we can call the detector function. results It lists coordinates (x, y, w,h) of bounding boxes around the detected object.

Can Haar Cascade detect multiple faces?

Some of them have a single side of the face visible, so the Haar model did not detect anything. Some of them have multiple faces detected as there more than one person in the images. In some of them, the model detects a tie as a face, or it detects only one eye in one of them.


2 Answers

OpenCV provides the confidence via the argument "weights" in function "detectMultiScale" from class CascadeClassifier, you need to put the flag "outputRejectLevels" to true

like image 81
user3611413 Avatar answered Sep 23 '22 10:09

user3611413


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.

like image 22
Ja͢ck Avatar answered Sep 22 '22 10:09

Ja͢ck