How to improve identification confidence using LBPHFaceRecognizer

asked 2019-12-24 01:38:33 -0500

LangdalePikes gravatar image

Hi, I am researching LBPHFaceRecognizer with the aim of implementing a face recognition system. However, I am only attaining confidence levels of no more than 80% and usually well below 50%. I have flipped the confidence returned from ' predictedId, predictedId, doubtLevel = recognizer.predict(imageNp) so that 100% is high confidence and 0% is low confidence.

Using Python I prepared the training dataset by:

Converting image to gray scale:-

pilImage ='L')         
imageNp = np.array(pilImage,'uint8')

Resizing the image:-

imageNp = cv2.resize(imageNp, (200, 200), interpolation=cv2.INTER_AREA)

Equalising the image Histogram:-

equalized_image = cv2.equalizeHist(imageNp)

Normalising the lighting in the Image:-

normalised_image = np.zeros((300, 300))
imageNp = cv2.normalize(imageNp, normalised_image, 0, 255, cv2.NORM_MINMAX)

and rotating the image so that eyes are horizontal, although the method I am using does not always do this completely for all images.

I am using images from vgg2Faces, ( in this instance Cybil_Shepherd and Anna_Kalata. Cybil_Shepherd has 160 images and Anna_Kalata, 442 images. I have removed images with more than 1 face and that are clearly not the stated person.

Once trained, I am attempting to recognize Anna_Kalata or Cybil_Shepherd using images from the original dataset but not included in the training set. All images are pre-processed in exactly the same way as those in the training set.

My question is two-fold: What confidence levels can I reasonably be expecting from LBPHFaceRecognizer? and How can Improve these confidence levels?

Thanks in advance for your help.

edit retag flag offensive close merge delete


  • what you get here are NOT confidence levels in percent, but distances, (smaller == better), and those are neither in [0..1] range, nor linear at all.
  • there is no provision taken for "unknown" persons, you'll always get the closest person from the trainset. it's up to you to find a good threshold value, and it all depends on your current data.

Normalising the lighting in the Image:-

no, it does not do that. it only moves it to [0..1]

berak gravatar imageberak ( 2019-12-24 01:57:37 -0500 )edit

Thanks for your feedback Berak!.

LangdalePikes gravatar imageLangdalePikes ( 2020-01-22 08:31:20 -0500 )edit

I am getting exactly the same distances returned during my identification run regardless of the parameters that I input in LBPHFaceRecognizer. However marked differences when I apply different parameters to LBPHFaceRecognizer during training. My request for help here is simply one for confirmation or negation. It would seem that the parameters should be used during training and not identification except Threshold which applies a cut off measure for a reasonable distance to accept during Identification. Is this correct?

LangdalePikes gravatar imageLangdalePikes ( 2020-01-23 00:29:10 -0500 )edit