{"action":"opened","issue":{"url":"https://api.github.com/repos/mshabunin/test2/issues/230","labels_url":"https://api.github.com/repos/mshabunin/test2/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/mshabunin/test2/issues/230/comments","events_url":"https://api.github.com/repos/mshabunin/test2/issues/230/events","html_url":"https://github.com/mshabunin/test2/issues/230","id":95688086,"number":230,"title":"Opencv FaceRecognition can not predicte new face?","user":{"login":"mshabunin","id":3304494,"avatar_url":"https://avatars.githubusercontent.com/u/3304494?v=3","gravatar_id":"","url":"https://api.github.com/users/mshabunin","html_url":"https://github.com/mshabunin","followers_url":"https://api.github.com/users/mshabunin/followers","following_url":"https://api.github.com/users/mshabunin/following{/other_user}","gists_url":"https://api.github.com/users/mshabunin/gists{/gist_id}","starred_url":"https://api.github.com/users/mshabunin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshabunin/subscriptions","organizations_url":"https://api.github.com/users/mshabunin/orgs","repos_url":"https://api.github.com/users/mshabunin/repos","events_url":"https://api.github.com/users/mshabunin/events{/privacy}","received_events_url":"https://api.github.com/users/mshabunin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mshabunin/test2/labels/auto-transferred","name":"auto-transferred","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/category:%20contrib","name":"category: contrib","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/category:%20legacy","name":"category: legacy","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/priority:%20normal","name":"priority: normal","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-17T16:03:54Z","updated_at":"2015-07-17T16:03:54Z","closed_at":null,"body":"Transferred from http://code.opencv.org/issues/2634\r\n```\n|| tianliang feng on 2012-12-17 09:07\n|| Priority: Normal\n|| Affected: None\n|| Category: legacy, contrib\n|| Tracker: Bug\n|| Difficulty: None\n|| PR: \n|| Platform: None / None\n```\n\nOpencv FaceRecognition can not predicte new face?\n-----------\n```\nOpencv FaceRecognition have 2 phase:training and predicting,After training, In the first phase,we trained 2 persons s1 and s2, \r\ns1/1.pgm;0 s1/2.pgm;0 s1/3.pgm;0 s1/4.pgm;0 s2/1.pgm;1 s2/2.pgm;1 s2/3.pgm;1 s2/4.pgm;1 then in the seconde phase,\r\nif I predict s1/5.pgm(whichever belong to person s1),i can get the label 0 and it is correct. if I predict s3/5.pgm(which is a face of a new person),the predicting result may be 0 or 1 but no -1,and it is wrong!\r\nI want to know when the I can get -1 by using predict method or how can I know the face belong to a new person?\r\n\r\nLook foward to your soonest reply! Thanks!\r\n\r\nThe original post is at \r\nhttp://answers.opencv.org/question/4604/help-opencv-facerecognition-can-not-predicte-new/\n```\n\nHistory\n-------\n##### Alexander Shishkov on 2012-12-17 09:29\n```\n-   Priority changed from Blocker to Normal\n-   Assignee set to Philipp Wagner\n-   Category set to legacy, contrib\n```\n##### Shervin Emami on 2013-01-09 01:47\n```\nI have also noticed this problem, that the FaceRecognizer's method of determining if someone is known or unknown is too unreliable. The task can be treated as \"Face Verification\", where you have a photo of a person and you need to decide if it really is that person or not. I wrote a more reliable solution for the Mastering OpenCV book (code is at \"https://github.com/MasteringOpenCV/code/tree/master/Chapter8_FaceRecognition\"):\r\n\r\n<pre>\r\n// Generate a face approximation by back-projecting the eigenvectors & eigenvalues.\r\nMat reconstructedFace;\r\nreconstructedFace = reconstructFace(model, preprocessedFace);\r\n\r\n// Verify whether the reconstructed face looks like the preprocessed face, otherwise it is probably an unknown person.\r\ndouble similarity = getSimilarity(preprocessedFace, reconstructedFace);\r\n</pre>\r\n\r\nIt usually works quite well for Eigenfaces/PCA because you have a lot of images available to reconstruct the face. For Fisherfaces it won't work quite as well but it still seems to be much more reliable than FaceRecognizer's existing solution of just loking at the Euclidean distance as the confidence metric to threshold.\r\n\r\nFeel free to replace the threshold technique of FaceRecognizer with some of the code from the book if you think it is a good idea.\r\n-Shervin Emami.\n```"}}