Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Face Recognition (2D Array) Confidence Formula Derivation

confidence = 1.0f - sqrt( distSq / (float)(nTrainFaces * nEigens) ) / 255.0f

  1. Why it is divided by (nTrainFaces*nEigens)?
like image 530
Newbiesss Avatar asked May 21 '26 21:05

Newbiesss


1 Answers

Why it is divided by (nTrainFaces*nEigens)?

Well, if you're just trying to find the confidence value for the 'test face eigenvectors (or values?)' with just 1 and only trained face, then you'd do something like

confidence = 1.0f - (sqrt( least_squared_distance / no_of_eigens ) / 255.0)

However, since you're finding nearest neighbour within trained face database, you want the confidence to reflect that your nearest neighbour gives a high confidence value for one of the faces in your trained database, amongst all the trained faces. Thus the confidence now is calculated not against 1 trained face, but with all trained faces, thus

confidence = 1.0f - (sqrt( least_squared_distance / no_of_trained_faces * no_of_eigens ) / 255.0)

"leastDistSq=DBL_MAX" what is DBL_MAX

least_squared_distance = DBL_MAX is basically a safe way from saying least_squared_distance = 99999999, since depending on the platform, hardware, or implementation, that might cause buffer overflow. So DBL_MAX is standard library that represents the largest double value.

And this is how it finds the least squared distance

if(distSq < leastDistSq) {
  leastDistSq = distSq;
  iNearest = iTrain;
}
like image 118
sub_o Avatar answered May 24 '26 22:05

sub_o