- pytorch == 1.7.1
- torchvision == 0.8.2
- CUDA 11
- Python 3
git clone https://github.com/Zacharynjust/FR-closeness-and-diversity.git --recursive
cd FR-closeness-and-diversity
pip install -r requirements.txt
This repo provides a united evaluation script for several FR benchmarks.
Currently, it supports small benchmark verification (e.g., LFW, CFP-FP, and AgeDB) and IJB verification, the code is mainly borrowed from insightface, MagFace, and AdaFace.
It also supports MegaFace verification and identification, the code is mainly borrowed from FFC. The advantage of this script is that it does not require an OpenCV-2.4 environment and works much faster; however, the identification protocol is a little different from the MegaFace official implementation, which may cause a slight performance drop (about 0.05 in our case).
For small benchmark evaluations (e.g., LFW, CFP-FP, and AgeDB), you can download them from [Baidu Cloud] [Google Drive] and then put *.bin
in eval_data
folder.
For IJB evaluation, you can access the datasets via the official link or insightface. (Please apply for permissions from NIST before your usage.)
For MegaFace evaluation, you can access the datasets and development kit via the official link or [Baidu Cloud]. (Please apply for permissions before your usage.)
Specify the model path and the dataset path in eval_config.py
python evaluate.py --opt eval
This repo provides a training script to represent our paper, all you need is to specify training settings in config.py
. Because a two-stage pipeline is adopted in our paper, we also provide the code to train vanilla ArcFace, see pretrain.py
Train plain ArcFace for a few epochs (e.g. 4) to get stable difficulty scores.
Note that you need to manually specify pretrain
setting entry in config.py
CUDA_VISIBLE_DEVICES="0,1,2,3" python pretrain.py --opt pretrain
In this step, you need to firstly specify model & difficulty score paths in order to resume the pretrained model.
CUDA_VISIBLE_DEVICES="0,1,2,3" python train.py
If you have any questions about this work, please contact the author by email at cyzhao@njust.edu.cn
If you find this code useful in your research, please consider citing us:
@inproceedings{zhao2022emphasizing,
title={Emphasizing Closeness and Diversity Simultaneously for Deep Face Representation},
author={Zhao, Chaoyu and Qian, Jianjun and Zhu, Shumin and Xie, Jin and Yang, Jian},
booktitle={Proceedings of the Asian Conference on Computer Vision},
pages={3430--3446},
year={2022}
}
This repo is built upon several excellent repos, e.g., insightface, face.evoLVe, CurricularFace, MagFace, AdaFace, and FFC.