Face Recognition (2D Array) Confidence Formula Derivation

安稳与你 提交于 2020-01-02 07:13:17

问题


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

  1. Why it is divided by (nTrainFaces*nEigens)?

回答1:


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


来源:https://stackoverflow.com/questions/22791971/face-recognition-2d-array-confidence-formula-derivation

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