Where should I use OpenCV LBPHFaceRecognizer parameters [closed]

asked 2020-01-22 08:33:01 -0500

LangdalePikes gravatar image

I am putting together a face recognition system using LBPHFaceREcognizer. I trained the system using default parameters:

recognizer = cv2.face.LBPHFaceRecognizer_create()

However, when I attempt to run identification on a different set of images of the same faces, using:

recognizer = cv2.face.LBPHFaceRecognizer_create(radius=4,neighbors=4, grid_x=4, grid_y=4,threshold=1000)


recognizer = cv2.face.LBPHFaceRecognizer_create(radius=8, neighbors=8, grid_x=8, grid_y=8, threshold=1000)

I get exactly the same confidence results every time regardless of the parameters I input. for example I attained the following results with both set of parameters as detailed above:

Image = dali_lama/0204_01.jpg, Predicted Name = Iannucci_armando, Confidence = 59.129611139955756
Image = dali_lama/0033_01.jpg, Predicted Name = dali_lama, Confidence = 35.95033592186442
Image = dali_lama/0014_01.jpg, Predicted Name = dali_lama, Confidence = 46.484885999676436
Image = adhyayan_suman/0054_01.jpg, Predicted Name = adhyayan_suman, Confidence = 42.50891337386948
Image = adhyayan_suman/0232_02.jpg, Predicted Name = adhyayan_suman, Confidence = -6.288158556775386
Image = adhyayan_suman/0024_01.jpg, Predicted Name = adhyayan_suman, Confidence = -2.7751504927476702
Image = adhyayan_suman/0138_01.jpg, Predicted Name = adhyayan_suman, Confidence = 9.082155772773092

I was expecting the identification parameters to affect the outcome but they do not seem to have any effect whatsoever. However, the same parameters when used in training do have an effect. Can someone please enlighten me as what I should be expecting and / or where I'm going wrong.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by berak
close date 2020-01-22 08:36:31.217174



please do NOT post duplicates here.

berak gravatar imageberak ( 2020-01-22 08:36:26 -0500 )edit

I posted the duplicate because after several days no one on stackoverflow had offered an answer. I therefore thought I might seek out the expertise available in opencv.org. Please enlighten me as to how I may go about attaining an answer to my question? Thanks. Langdale.

LangdalePikes gravatar imageLangdalePikes ( 2020-01-22 12:29:28 -0500 )edit

no one on stackoverflow had offered an answer

hehehe, still, rather update your previous question here

berak gravatar imageberak ( 2020-01-22 12:56:15 -0500 )edit

btw, curious, how you obtain negative distances ... should never happen.

berak gravatar imageberak ( 2020-01-22 12:58:28 -0500 )edit

Hello Berak. Unfortunately, I have no idea how I obtained negative distances. I used the algorithm as shown above and obtained the results posted. According to other programs that I have seen what I have done is correct.

Despite the fact that I posted a duplicate question do you have any ideas that can help me?

Thanks Langdale.

LangdalePikes gravatar imageLangdalePikes ( 2020-01-22 23:09:27 -0500 )edit

Actually I think the negative confidence levels are because I have flipped the distance, (confidence = 100 - float(distance)) to attain a 'Confidence'. I'm getting some distances greater than 100.

LangdalePikes gravatar imageLangdalePikes ( 2020-01-22 23:56:16 -0500 )edit