This repository integrates and extends the code from https://github.com/jonasgrebe/pt-femb-face-embeddings.
The datasets for training can be downloaded from the Insightface Datasets Github Page. The training datasets are provided in mxnet RecordIO file format.
-
Install miniconda
-
Create environment with
conda env create -n femb -f environment.yml
-
Install pip requirements with
conda activate femb pip install -r requirements.txt
-
Install pre-commit hooks with
pre-commit install
We provide a train script and a predict script that can be executed with a matching config file.
Example for training:
python train.py --config configs/train_arcface_ddp.yaml
Example for prediction:
python predict.py --config configs/predict_arcface.yaml
To generate predictions on the official model checkpoints, you first need to download the checkpoints and put them into the checkpoints/
directory.
Checkpoints for ArcFace can be downloaded at: Arcface Repository
Checkpoints for MagFace can be downloaded at: MagFace Repository
- IResNet: Improved Residual Networks for Image and Video Recognition (ICCV, 2021)
- SphereFaceHeader: SphereFace: Deep Hypersphere Embedding for Face Recognition (CVPR, 2017)
- CosFaceHeader: CosFace: Large Margin Cosine Loss for Deep Face Recognition (CVPR, 2018)
- ArcFaceHeader: ArcFace: Additive Angular Margin Loss for Deep Face Recognition (CVPR, 2019)
- MagFaceHeader: MagFace: A Universal Representation for Face Recognition and Quality Assessment (CVPR, 2021)
- Load ArcFace checkpoint from official Arcface repository
- Train own ArcFace model and save it compatible to official Arcface checkpoint
- Add ElasticFace header
- Compare MagFace training to official Magface code
- Remove
mxnet
dependency. Therefore it is necessary to convert the datasets.