Ask Your Question

Revision history [back]

Face recognition, different results for same image

Hello,

I am working on a face recognition project. These are the pre-processing steps I use:
1. crop the face from the original image using lbpcascade_frontalface.xml (this will result in a square image)
2. convert the image to grayscale
3. resize the image to a fixed size (50, 50)

After this I use the images resulted to train a LBPH face recognizer. From my tests it seems that the recognizer returns a confidence that represents the best match between the tested image and another image in the training set(please correct me if I'm wrong). I tried training the model with 15 images and then trained it with only the best matching image and I got the same exact confidence in both cases.

To verify the accuracy I tried this: I took an image, used it for training. Cropped the image manually in gimp(the face is not affected by the crop). And I tested the original image against the cropped image and only got a confidence of 42.48...(the range seems to be between 0..100, identical images giving 0.0 as a result, so I'm not sure if it's good to have a big confidence or not, either way 42 is in the middle so the confidence is not very good). I argue that the confidence should be very good since the faces in the images are identical.

I observe 2 problems here:

1. After pre-processing, the 2 resulting images were not the same. Even though the face in the images was exactly the same, after pre-processing, one image had the face cropped more than the other(you could see more chin and forehead). the differences were not big, but observable, even on a 50x50 image. Again, I argue that the rectangle of the face detection should have been exactly the same. Please tell me if I'm doing something wrong or if I could improve this in any way.


2. The recognizer didn't work very well, even though the image was exactly the same but it was cropped differently. I did read the basic principles of lbp before starting this project and I understand why it would have problems with images that are cropped differently, but this is a big issue since there will always be differences in cropping(for instance if you open your mouth, your face will be bigger so the cropping will be different). Again, If you have any suggestions on how to improve this, please tell me.

I use the default values for the "train", "predict" and "detectMultiScale" methods. Maybe this is something that I could improve, but I'm not sure how.

Note. This is probably not important, but I use java with opencv on an Ubuntu machine.