timesler / facenet-pytorch

Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models
MIT License
4.54k stars 951 forks source link

Why there is no alignment of the faces found? #188

Open Edremelech opened 2 years ago

Edremelech commented 2 years ago

The sample notebook infer.ipynb implies that mtcnn() returns the aligned images (x_aligned), but it doesn't! I've tested it on some non-aligned faces, and the faces weren't rotated (rotation is described here: https://sefiks.com/2020/09/09/deep-face-detection-with-mtcnn-in-python).

What's the sense in the landmarks if you don't align the image? And why mtcnn() doesn't return the landmarks if you want to leave the rotation to the user?

gregworks commented 1 year ago

I'm guessing this is because 1 method for cropping/alignment shown in the paper doesn't do alignment at all, but simply crops the area where a face is detected and feeds that to resnet portion of the model:

Our model is evaluated in two modes:
  1. Fixed center crop of the LFW provided thumbnail.
  2. A proprietary face detector (similar to Picasa [3]) is run on the provided LFW thumbnails. If it fails to align the face (this happens for two images), the LFW alignment is used.

Figure 6 gives an overview of all failure cases. It shows false accepts on the top as well as false rejects at the bottom. We achieve a classification accuracy of 98.87%±0.15 when using the fixed center crop described in (1) and the record breaking 99.63%±0.09 standard error of the mean when using the extra face alignment (2)

Paper: https://arxiv.org/pdf/1503.03832.pdf