Poor LBPHfacerecognizer results in Python OpenCV 3.3.0

asked 2018-03-06 16:59:52 -0500

CAJ gravatar image

I trained a face recognition system, using this guide as starter code. We are trying to do face recognition on images that are 326x244. I trained the recognizer using about 250 unique images of my face, which I downsampled to width 326, and also flipped them horizontally to extend the training set to 500 images. When I run the images through the detector, about 400 faces are successfully detected that I subsequently train the recognizer on.

I'm running the face detector with scaleFactor 1.1 (if I do lower a lot of 'fake' faces are found), minNeighbors=5 and minSize=20. I set the face recognizer threshold to 120.

When I go through the test set of about 30 images, the confidence metric (distance) for images of my own face seem unusually high--somewhere between 100 and 120. I have images of two other people I did not train on, so they should receive no label. One person's distance from my face is ~120-140, and because of the threshold setting they remain unlabeled. The second person is frequently mislabeled as me, with distances ~110-120.

Why might the distance for my own face so high? Why are random people being mistaken for me? I feel like the training set is a pretty respectable size.

edit retag flag offensive close merge delete

Comments

seems, you mistakenly try to abuse a identification mechanism for authentification purpose

(it can't handle "unknown" persons well)

berak gravatar imageberak ( 2018-03-06 21:43:41 -0500 )edit

"and also flipped them horizontally " -- no, bad idea here.

berak gravatar imageberak ( 2018-03-06 22:06:47 -0500 )edit

I don't see any reason why it shouldn't handle unknown persons well, nor is that indicated anywhere in any official OpenCV documentation that I can tell. From what I understand, the predict procedure searches the DB and measures the distance between known faces and the input image face. If the distance between the input image and known faces are all large enough, it returns -1. Here, images of a known person are getting a similar distance measure as random people. I should see a lower distance between images of myself than images of unknown people, yet that is not happening.

cjoseph gravatar imagecjoseph ( 2018-03-06 22:16:04 -0500 )edit

did you properly crop/align your images ? else it's just finding the same background

lbph features are just a minor improvement over usng plain image pixels, and the nearest neighbour distance is pretty blunt, too.

maybe you can try the openface dnn, or a one-against-all SVM. MACE filters are also good for authentication

berak gravatar imageberak ( 2018-03-07 02:49:06 -0500 )edit