I'm using opencv's har cascade face detector (cv.HaarDetectObjects) in python.
for example:
faces = cv.HaarDetectObjects(grayscale, cascade, storage, 1.2, 2,
cv.CV_HAAR_DO_CANNY_PRUNING, (50,50))
for f in faces:
print(f)
This will print a list of detections in this form:
((174, 54, 114, 114), 53)
((22, 51, 121, 121), 36)
((321, 56, 114, 114), 21)
((173, 263, 125, 125), 51)
((323, 272, 114, 114), 20)
((26, 271, 121, 121), 36)
Where each line represent a detection. The first 4 numbers are the x,y location of the top-left point, and the height, width of the bounding box. The last number is (quoting from the openCV documentation) the number of neighbors.
I guess I have two questions:
1) What does the last number mean? I couldn't find any reference to that when googling.
2) (more important)Is there a way to get a confidence score for each detection? How much is the face classifier certain that the detection corresponds to a real face?
Thanks
Confidence scores are a critical component of face detection and comparison systems. These systems make predictions of whether a face exists in an image or matches a face in another image, with a corresponding level of confidence in the prediction.
Various face detection algorithms are there but the Viola-Jones Algorithm is the oldest method that is also used today. Face detection is generally the first step towards many face-related applications like face recognition or face verification.
Classifier is a device which decides whether the taken image is negative or positive. It is trained on hundreds of thousands of face and non-face images to learn to classify a new image as face or non-face image correctly.
Positive images are those images that consist of faces, and negative images are without faces. In face detection, image features are treated as numerical information extracted from the pictures that can distinguish one image from another. We apply every feature of the algorithm on all the training images.
1) The detection code produces more than one detection for an object - e.g. in different scales, slightly shifted, etc. The detections are then grouped and the number of neighbours in such a group is the number returned. See also Viola Jones paper, paragraph 5.6 (http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf) and OpenCV source.
2) You can possibly use the number of neighbours as some measure of confidence.
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