Skip to content

PyTorch implementation of Additive Angular Margin Loss for Deep Face Recognition.

License

Notifications You must be signed in to change notification settings

apache2046/InsightFace-PyTorch

 
 

Repository files navigation

InsightFace

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}
}

Performance

  • sgd with momentum
  • margin-m = 0.6
  • margin-s = 64.0
  • batch size = 256
  • input image is normalized with mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225]
Models MegaFace LFW Download
SE-LResNet101E-IR 98.06% 99.80% Link

Dataset

Function Dataset
Train MS-Celeb-1M
Test MegaFace

Introduction

MS-Celeb-1M dataset for training, 3,804,846 faces over 85,164 identities.

Dependencies

  • Python 3.6.8
  • PyTorch 1.3.0

Usage

Data wrangling

Extract images, scan them, to get bounding boxes and landmarks:

$ python extract.py
$ python pre_process.py

Image alignment:

  1. Face detection(Retinaface mobilenet0.25).
  2. Face alignment(similar transformation).
  3. Central face selection.
  4. Resize -> 112x112.
Original Aligned & Resized Original Aligned & Resized
image image image image
image image image image
image image image image
image image image image
image image image image

Train

$ python train.py

To visualize the training process:

$ tensorboard --logdir=runs

Performance evaluation

MegaFace

Introduction

MegaFace dataset includes 1,027,060 faces, 690,572 identities.

Challenge 1 is taken to test our model with 1 million distractors.

image

Download

  1. Download MegaFace and FaceScrub Images
  2. Download FaceScrub annotation files:
    • facescrub_actors.txt
    • facescrub_actresses.txt
  3. Download Linux DevKit from MagaFace WebSite then extract to megaface folder:
$ tar -vxf linux-devkit.tar.gz

Face Alignment

  1. Align Megaface images:
$ python3 align_megaface.py
  1. Align FaceScrub images with annotations:
$ python3 align_facescrub.py

Evaluation

$ python3 megaface_eval.py

It does following things:

  1. Generate features for FaceScrub and MegaFace.
  2. Remove noises.
    Note: we used the noises list proposed by InsightFace, at https://github.com/deepinsight/insightface.
  3. Start MegaFace evaluation through devkit.

Results

Curves

Draw curves with matlab script @ megaface/draw_curve.m.

CMC ROC
image image
image image
Textual results
Done matching! Score matrix size: 3359 966804
Saving to results/otherFiles/facescrub_megaface_0_1000000_1.bin
Loaded 3359 probes spanning 80 classes
Loading from results/otherFiles/facescrub_facescrub_0.bin
Probe score matrix size: 3359 3359
distractor score matrix size: 3359 966804
Done loading. Time to compute some stats!
Finding top distractors!
Done sorting distractor scores
Making gallery!
Done Making Gallery!
Allocating ranks (966884)

Rank 1: 0.980616

小小的赞助~

Sample

若对您有帮助可给予小小的赞助~




About

PyTorch implementation of Additive Angular Margin Loss for Deep Face Recognition.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.7%
  • MATLAB 1.3%