QAMFace
QAMFace copied to clipboard
Pytorch implementation of Quadratic Additive Angular Margin Loss for Face Recognition
QAMFace
Pytorch implementation for Quadratic Additive Angular Margin Loss for Face Recognition
License
The code is released under the MIT License.
News
2020.1.15
We released our QAMFace loss and training codes.
Pre-Requisites
- Linux or macOS
- Python 3 (for training & validation)
- PyTorch 1.0 (for traininig & validation, install w/
pip install torch torchvision
) - MXNet 1.3.1 (optional, for data processing, install w/
pip install mxnet
) - tensorboardX 1.4 (optional, for visualization, install w/
pip install tensorboardX
) - OpenCV 3 (install w/
pip install opencv-python
) - bcolz 1.2.0 (install w/
pip install bcolz
) We used 4 NVIDIA RTX 2080Ti in parallel. More GPUs which support larger batch-size may perform better.
Usage
Data Preprocess
- Download training data from IngishtFace Dataset Zoo, we highly recommand you to use emore.
- Unzip the file. Edit the
save_path
andrec_path
in make_extracted.py. Run this script to extract image from mx_rec data. - Edit the
conf.data_path
in config.py withsave_path
mentioned above. - For data augmentation, we simply apply horizental flip. If you want use more complicated process to achieve higher performance, please refer to face.evoLVe which proved good examples.
Model Training and Validation
- Hyper parameters such as batch-size, learning rate can be edited in train.py.
- Hyper parameters of loss functions such as s and m can be edited in model.py
- Run train.py to train and validate the model.
- Use tensorboard to monitor the training log :
tensorboard --logdir='./'
.
Performance
model
Backbone | Head | Loss | Training Data |
---|---|---|---|
IRSE-50 | ArcFace | Focal | emore |
Setting)
- INPUT_SIZE: [112, 112]
- BATCH_SIZE: 256 (drop the last batch to ensure consistent batch_norm statistics)
- Initial LR: 0.2;
- NUM_EPOCH: 22;
- WEIGHT_DECAY: 5e-4 (do not apply to batch_norm parameters);
- MOMENTUM: 0.9; STAGES: [30, 60, 90];
- Augmentation: Horizontal Flip;
- Solver: SGD;
- GPUs: 4 NVIDIA RTX 2080Ti in Parallel
Performance
LFW | CFP_FF | CFP_FP | AgeDB | CALFW | CPLFW | Vggface2_FP |
---|---|---|---|---|---|---|
99.82 | 99.89 | 98.04 | 98.12 | 96.12 | 92.80 | 95.64 |
Acknowledgement
- This repo is inspired by
Citation
If you find this repo useful for your research, please consider citing the paper
@inproceedings{zhao2020qamface,
title={Qamface: Quadratic Additive Angular Margin Loss For Face Recognition},
author={Zhao, He and Shi, Yongjie and Tong, Xin and Ying, Xianghua and Zha, Hongbin},
booktitle={2020 IEEE International Conference on Image Processing (ICIP)},
pages={1901--1905},
year={2020},
organization={IEEE}
}