PyTorch implementation of Additive Angular Margin Loss for Deep Face Recognition. paper.
@article{deng2018arcface,
title={ArcFace: Additive Angular Margin Loss for Deep Face Recognition},
author={Deng, Jiankang and Guo, Jia and Niannan, Xue and Zafeiriou, Stefanos},
journal={arXiv:1801.07698},
year={2018}
}
Function | Dataset |
---|---|
Train | MS-Celeb-1M |
Test-1 | LFW |
Test-2 | MegaFace |
MS-Celeb-1M dataset for training, 3,804,846 faces over 85,164 identities.
- Python 3.6.8
- PyTorch 1.3.0
Extract images, scan them, to get bounding boxes and landmarks:
$ python extract.py
$ python pre_process.py
Image alignment:
- Face detection(MTCNN).
- Face alignment(similar transformation).
- Central face selection.
- Resize -> 112x112.
Original | Aligned & Resized | Original | Aligned & Resized |
---|---|---|---|
$ python train.py
To visualize the training process:
$ tensorboard --logdir=runs
Use Labeled Faces in the Wild (LFW) dataset for performance evaluation:
- 13233 faces
- 5749 identities
- 1680 identities with >=2 photo
Download LFW database put it under data folder:
$ wget http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz
$ wget http://vis-www.cs.umass.edu/lfw/pairs.txt
$ wget http://vis-www.cs.umass.edu/lfw/people.txt
$ python lfw_eval.py
Backbones | LFW(%) | Inference speed(*) |
---|---|---|
SE-LResNet101E-IR | 99.83% | 46.63 ms |
SE-LResNet50E-IR | 99.75% | 27.30 ms |
SE-LResNet18E-IR | 99.65% | 17.53 ms |
Note(*): with 1 Nvidia Tesla P100.
See also LFW Face Database Errata
2 false positives:
1 | 2 | 1 | 2 |
---|---|---|---|
8 false negative:
1 | 2 | 1 | 2 |
---|---|---|---|
MegaFace dataset includes 1,027,060 faces, 690,572 identities. Link
Challenge 1 is taken to test our model with 1 million distractors.
- Download MegaFace and FaceScrub Images
- Download Linux DevKit from MagaFace WebSite then extract to megaface folder:
$ tar -vxf linux-devkit.tar.gz
- Crop MegaFace.
- Generate features for FaceScrub and MegaFace.
- Remove noises. Note: we used the noises list proposed by InsightFace, at https://github.com/deepinsight/insightface.
$ python3 megaface.py --action crop_megaface
$ find megaface/facescrub_images -name "*.bin" -type f -delete
$ find megaface/MegaFace_aligned/FlickrFinal2 -name "*.bin" -type f -delete
$ python3 megaface.py --action gen_features
Start MegaFace evaluation through devkit:
$ cd megaface/devkit/experiments
$ python run_experiment.py -p /dev/code/mnt/InsightFace-v2/megaface/devkit/templatelists/facescrub_uncropped_features_list.json /dev/code/mnt/InsightFace-v2/megaface/MegaFace_aligned/FlickrFinal2 /dev/code/mnt/InsightFace-v2/megaface/facescrub_images _0.bin results -s 1000000
Draw curves with matlab script @ megaface/draw_curve.m.
CMC | ROC |
---|---|
Done matching! Score matrix size: 3379 972313 Saving to results/otherFiles/facescrub_megaface_0_1000000_1.bin Computing test results with 1000000 images for set 1 Loaded 3379 probes spanning 80 classes Loading from results/otherFiles/facescrub_facescrub_0.bin Probe score matrix size: 3379 3379 distractor score matrix size: 3379 972313 Done loading. Time to compute some stats! Finding top distractors! Done sorting distractor scores Making gallery! Done Making Gallery! Allocating ranks (972393) Rank 1: 0.964733