Any tips on confidence score for face verification (as opposed to face recognition)?

徘徊边缘 提交于 2019-12-21 20:48:31

问题


I'm using eigenfaces (PCA) for face recognition in my code. I used the tutorials in OpenCV's website as a reference. While this works great for recognizing faces (ie it can tell you who is who correctly), the confidence-score based face verification (or imposter detection- verifying whether the face is enrolled in the training set) doesn't work well at all.

I compute a Euclidean distance and use it as a confidence threshold. Are there any other ways I could calculate a confidence threshold? I tried using Mahalanobis distance as mentioned in http://www.cognotics.com/opencv/servo_2007_series/part_5/page_5.html , but it was producing pretty weird values.

PS: Solutions like face.com won't probably work for me because I need to do everything locally.


回答1:


You can project the new input face onto the Eigenspace using subspaceProject() function and then generate the reconstructed face back from the Eigenspace using subspaceReconstruct() and then compare how similar the input_face and the reconstructed_face is. A known face (face in the training data set) will have the reconstructed image more similar to the input_face than an imposter's face. You can set a similarity threshold for verification. Here's the code:

// Project the input face onto the eigenspace.
Mat projection = subspaceProject(eigenvectors, FaceRow,input_face.reshape(1,1));

//Generate the reconstructed face
Mat reconstructionRow = subspaceReconstruct(eigenvectors,FaceRow, projection);

// Reshape the row mat to an image mat
Mat reconstructionMat = reconstructionRow.reshape(1,faceHeight);

// Convert the floating-point pixels to regular 8-bit uchar.
Mat reconstructed_face = Mat(reconstructionMat.size(), CV_8U);

reconstructionMat.convertTo(reconstructed_face, CV_8U, 1, 0);

You can then compare the input face and the reconstructed face using cv::norm(). For example:

// Calculate the L2 relative error between the 2 images. 
double err = norm(input_face,reconstructed_face, CV_L2);
// Convert to a reasonable scale
double similarity = error / (double)(input_face.rows * input_face.cols);



回答2:


You can look at feature extraction algorithms other than PCA like LDA (Linear Discriminant Analysis) or Local Binary Patterns (LBP).

LDA models interclass variation and LBP is an illumination invariant descriptor. You have the implementation of both these algorithms in OpenCV. Check the below link.

http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html



来源:https://stackoverflow.com/questions/8757149/any-tips-on-confidence-score-for-face-verification-as-opposed-to-face-recogniti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!