Ask Your Question
0

Confidence values for all faces from FaceRecognizer?

asked 2013-08-28 04:23:51 -0600

Is it possible to get a list of confidence values against all faces trained in a face recognition model?

What I'd like to to is not just return the predicted label, but see a confidence level against a particular face/all faces in the dataset used to train the model so that I can identify the possibility of a specific person being in front of the camera.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-08-28 05:01:23 -0600

berak gravatar image

updated 2013-08-28 05:06:03 -0600

the current implementation does a single nearest neighbour search over all items in the traindb, and returns the label and the distance of the best match. that distance is inverse proportional to "confidence".

it you're willing to hack the library, it should not be too difficult to return a label<-->distance map as well

here's the resp. (original) code section from LBPH::predict() (contrib/src/facerec.cpp:836):

for(size_t sampleIdx = 0; sampleIdx < _histograms.size(); sampleIdx++) {
    double dist = compareHist(_histograms[sampleIdx], query, CV_COMP_CHISQR);
    if((dist < minDist) && (dist < _threshold)) {
        minDist = dist;
        minClass = _labels.at<int>((int) sampleIdx);
    }
}

so, once you got the distance for a db-sample, you could add it to a list(in the same order as the labels/images) or an id-dist map, and return it. that's the easy part.

unfortunately, since all this code is behind an interface, you've got to modify this as well, same for the other 2 facerecos(eigen/fisher).

alternatively, you could just paste the code to your own file, and use your own interface, no idea what's more adequate for you.

good luck, and happy hacking !

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-08-28 04:23:51 -0600

Seen: 2,157 times

Last updated: Aug 28 '13