Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is confidence in OpenCV's FaceRecognizer?

I've been working on a face recognition project using OpenCV's FaceRecognizer, doing gender differentiation. The algorithm works pretty well, but I wanted to implement some extra features into my program like the confidence of the prediction.

The predict function can output a confidence level, but I'm not sure what it means. What does this confidence actually measure, and can I convert it into a percentage?

int predictedLabel = -1;
double confidence = 0.0;
model->predict(face_resized, predictedLabel, confidence);
string result_message = format("Predicted class = %d / Confidence = %d.", predictedLabel, confidence);
cout << result_message << endl;

Here's what the output looks like. https://www.dropbox.com/s/65h1n5180ulz3hl/facerecConfidence%20.jpg

like image 293
hammerhands Avatar asked Nov 30 '12 20:11

hammerhands


People also ask

What is confidence in face detection?

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.

What is confidence in OpenCV?

If the confidence is higher, then it means that the pictures are less similar, or in other words the lower, the better.

How face recognition works in OpenCV?

OpenCV uses machine learning algorithms to search for faces within a picture. Because faces are so complicated, there isn't one simple test that will tell you if it found a face or not. Instead, there are thousands of small patterns and features that must be matched.


1 Answers

There's a brief discussion on what this distance actually is on the OpenCV-users list here.

To summarise, the function they use is:

distance = 1.0f - sqrt( distSq / (float)(nTrainFaces * nEigens) ) / 255.0f 

However, the author of the function says that it is a very rough guide and not a full proof guide. See the link to the users list discussion for a reference to the paper and a suggestion for an alternative metric.

like image 128
Chris Avatar answered Oct 13 '22 23:10

Chris