cavaface.pytorch: A Pytorch Training Framework for Deep Face Recognition
By Yaobin Li
Introduction
This repo provides a high-performance distribute parallel training framework for face recognition with pytorch, including various backbones (e.g., ResNet, IR, IR-SE, ResNeXt, AttentionNet-IR-SE, ResNeSt, HRNet, etc.), various losses (e.g., Softmax, Focal, SphereFace, CosFace, AmSoftmax, ArcFace, ArcNegFace, CurricularFace, Li-Arcface, QAMFace, etc.), various data augmentation(e.g., RandomErasing, Mixup, RandAugment, Cutout, CutMix, etc.) and bags of tricks for improving performance (e.g., FP16 training(apex), Label smooth, LR warmup, etc)
Main requirements
- torch == 1.4.0
- torchvision == 0.5.0
- tensorboardX == 1.7
- bcolz == 1.2.1
- Python 3
- Apex == 0.1
Features
- Backone
- ResNet(IR-SE)
- ResNeXt
- DenseNet
- MobileFaceNet
- MobileNetV3
- EfficientNet
- VargFaceNet
- ProxylessNas
- GhostNet
- AttentionNet-IRSE
- EfficientPolyFace
- ResNeSt
- Attention Module
- SE
- CBAM
- ECA
- ACNet
- Loss
- Softmax
- SphereFace
- Am_Softmax
- CosFace
- ArcFace
- Combined Loss
- AdaCos
- SV-X-Softmax
- CurricularFace
- ArcNegFace
- Li-Arcface
- QAMFace
- Parallel Training
- Data Parallel
- Model Parallel
- Automatic Mixed Precision
- Apex
- Optimizer
- Data Augmentation
- Blur
- RandomErasing(官方版torchvision.transforms.RandomErasing)
- Mixup
- RandAugment
- Cutout
- CutMix
- Distillation
- KnowledgeDistillation
- Multi Feature KD
- Bag of Tricks
- Label smooth
- LR warmup
- Zero gamma
Quick start
Installation
- Install pytorch==1.4.0 following and torchvision==0.5.0official instruction.
- Clone this repo, and we'll call the directory that you cloned as ${WORK_ROOT}.
- Install dependencies:
pip install -r requirements.txt
Data preparation
For training data, please download the ms1m-retinaface in https://github.com/deepinsight/insightface/tree/master/iccv19-challenge.
For test data, please download the megaface and ijbc in https://github.com/deepinsight/insightface/tree/master/Evaluation.
Training and Testing
Training on ms1m-retinaface
You can change the experimental setting by simply modifying the parameter in the config.py
bash train.sh
# To evaluate the model on validation set:
(1)please first download the val data in https://github.com/ZhaoJ9014/face.evoLVe.PyTorch.
(2)set the checkpoint dir in config.py
bash evaluate.sh
Testing on Megaface and IJBC
- Put the test data and image list into proper directory.
- Start evaluation service.
nohup python evaluate_service.py > logs/log.service &
- Start extracting features and evaluating.
nohup bash run.sh > logs/log &
Benchmark
Backbone | Head | Loss | Flops | Megaface(Id/ver@1e-6) | IJBC(tar@far=1e-4) |
---|---|---|---|---|---|
MobileFaceNet | Arcface | Softmax | 440M | 92.8694/93.6329 | 92.80 |
AttentionNet-IRSE-92 | MV-AM | Softmax | 17.63G | 99.1356/99.3999 | 96.56 |
IR-SE-100 | Arcface | Softmax | 24.18G | 99.0881/99.4259 | 96.69 |
IR-SE-100 | ArcNegface | Softmax | 24.18G | 99.1304/98.7099 | 96.81 |
IR-SE-100 | Curricularface | Softmax | 24.18G | 99.0497/98.6162 | 97.00 |
IR-SE-100 | Combined | Softmax | 24.18G | 99.0718/99.4493 | 96.83 |
IR-SE-100 | CircleLoss | Softmax | 24.18G | 98.5732/98.4834 | 96.52 |
ResNeSt-101 | Arcface | Softmax | 18.45G | 98.6279/98.7307 | 96.65 |
Acknowledgement
- This repo is modified and adapted on these great repositories face.evoLVe.PyTorch, CurricularFace, insightface and imgclsmob
- The evaluation tools is developed by Charrin
Contact
cavallyb@gmail.com