Ask Your Question
0

Help ! Opencv FaceRecognition can not predicte new face?

asked 2012-11-27 03:39:26 -0600

fengtianliang gravatar image

hi everyone: Opencv FaceRecognition have 2 phase:training and predicting,After training, In the first phase,we trained 2 persons s1 and s2, s1/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,if 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!

I 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?

Look foward to your soonest reply! Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-11-28 01:59:07 -0600

Afnman gravatar image

You must set a threshold for your Face Recognition Algorithm.For Example:

Ptr<FaceRecognizer> model = createEigenFaceRecognizer()
    model->set("threshold", 3000.0);

if the distance of your tested face from the trained face is above 3000.0 (threshold) then will be considered as unknown (-1).

See details here: http://docs.opencv.org/modules/contrib/doc/facerec/facerec_api.html

edit flag offensive delete link more

Comments

hi Elias Rammos: If I set the threshold to 3000.some trained person'faces can not be recognize,so the threshold must be appropriate. Do you know how to calculate the threshold ?

fengtianliang gravatar imagefengtianliang ( 2012-11-28 02:48:54 -0600 )edit

That's my problem too. Maybe in your case you can find it with trials and errors. Others set the threshold as the maximum value of minimum Euclidean distances of each face from other faces In general case, the threshold varies according to illuminations,faces background,translations etc. It If you find something that works for all situations, I would like to know it.

Afnman gravatar imageAfnman ( 2012-11-29 01:58:51 -0600 )edit

Hi! Did you find any solution for this problem? I am also looking that how to calculate the best threshold.

BAHRAMUDIN ADIL gravatar imageBAHRAMUDIN ADIL ( 2017-07-25 02:32:41 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-27 03:39:26 -0600

Seen: 4,996 times

Last updated: Nov 28 '12