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

喜夏-厌秋 提交于 2019-12-04 11:47:33
PraveenPalanisamy

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);

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

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