Ask Your Question

OpenCV face recognition prediction and confidence values

asked 2017-09-27 05:34:26 -0500

Sagar9172 gravatar image

Hi, i am developing face recognition software using OpenCV in C++. For that i am using createLBPHFaceRecognizer(). So when i call predict function(e.g. model->predict(face, predictedLabel, predictedConfidence)), i am getting confidence value around 100 when user face is near to camera but as i maintain some distance between camera and face then it will give confidence around 200 or max sometimes. So i am confused about this result. why i am getting this much of variation. Is there something i missed ? And which confidence is good, 100 or 200?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-09-27 05:49:43 -0500

berak gravatar image

what you get as "confidence", is actually the opposite - the distance to the closest item in the database.

(so, 100 is better than 200, and 0 would be a "perfect match")

so, if you move away from the camera, the recognition will degrade.

edit flag offensive delete link more


But if i give used 1.jpg for training and after that i used same image(1.jpg) in recognition as a input. Still is is giving confidence like 70-80. But according to all documents it should give 0. Isn't it?

Sagar9172 gravatar imageSagar9172 ( 2017-09-27 06:03:04 -0500 )edit

hard to see, what you're doing, but you probably should not use jpg images for this. lossy compression and the blocky compression artefacts seriously mess with the lbph algorithm

berak gravatar imageberak ( 2017-09-27 08:41:15 -0500 )edit

@berak then which img format should we use....& one more Q does img quality,size,resolution,scalefactor value.... increases the confidence value....

wasit gravatar imagewasit ( 2019-06-08 06:28:36 -0500 )edit

@wasit, if you can, prefer png or similar.

but in 2019, you should probably use a facenet encoding, not lbph

berak gravatar imageberak ( 2019-06-08 07:47:17 -0500 )edit

@berak tnks...

wasit gravatar imagewasit ( 2019-06-09 10:27:13 -0500 )edit

Question Tools

1 follower


Asked: 2017-09-27 05:34:26 -0500

Seen: 7,490 times

Last updated: Sep 27 '17