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?
By using Equation (3) Accuracy is obtained for the Haar cascade is 96.24% and for LBP classifier 94.74%.
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.
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.
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.
OpenCV provides the confidence via the argument "weights" in function "detectMultiScale" from class CascadeClassifier, you need to put the flag "outputRejectLevels" to true
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With