Why Does FaceRecognizers predict function return 1.79769e+308 as distance.

asked 2016-01-05 08:17:26 -0600

Z3non gravatar image

Hello everybody, I am using opencv and LBPHFaceRecognizer and I am observing a strange behaviour of predict function when looking at an unknown face:

 int radius=1;
 int neighbors=8;
 int grid_x=8;
 int grid_y=8;
 double threshold=DBL_MAX;

_lbhp_recognizer = createLBPHFaceRecognizer(radius,neighbors,grid_x,grid_y,threshold);
_lbhp_recognizer->train(training_set,_labels);
_lbhp_recognizer->predict(face_gray,label,confidence);

Seems to work correctly since it returns confidence=136.55 and a label corresponding to the best approximation of my unknown face.

However when I modify threshold in order to be less than 136.55 as follows

double threshold=130;

I obtained confidence=1.79769e+308 and label=0 !

As far as I understood threshold and predict I should obtained label=-1 since the distance to the best approximation is greater than threshold ...

I am be bit lost then.

Thanks !

edit retag flag offensive close merge delete

Comments

which opencv version is it ?

(looking at the 3.1 src, it seems, @comdiv 's latest update changed the default from -1 to 0)

actually, do we agree, that the distance is correct, but the label is not (should be -1) ?

berak gravatar imageberak ( 2016-01-05 08:25:12 -0600 )edit

Well, version 3.1. Do you mean that the behaviour of predict is to return distance 1.79769e+308 when the computed distance is greater than the threshold ? If it is the case then yes my problem is the fact that the returned label is 0 and not -1 .

Thanks !

Z3non gravatar imageZ3non ( 2016-01-05 09:16:45 -0600 )edit

i'm unsure, what distance should be returned, if it did not pass the threshold test, but imho, it should return -1 for the label in this case, like the previous versions did.

berak gravatar imageberak ( 2016-01-05 09:38:33 -0600 )edit

anyway, bug, pr on the way ...

berak gravatar imageberak ( 2016-01-05 09:43:59 -0600 )edit
1

:), thanks !

Z3non gravatar imageZ3non ( 2016-01-05 09:49:40 -0600 )edit