InterFace is a novel loss function for face recognition that enhances discriminative power by adding margin penalties between deep features and all weights, not just between features and their corresponding weights. This approach increases class separability and reduces intra-class variations, making models more robust in real-world scenarios.
This is a deep learning library that makes face recognition efficient, and effective, which can train tens of millions identity on a single server.
- Install PyTorch (torch>=1.6.0), our doc for install.md.
- (Optional) Install DALI, our doc for install_dali.md.
pip install -r requirement.txt
.
To train a model, run train.py
with the path to the configs.
The example commands below show how to run
distributed training.
python -m torch.distributed.launch --nproc_per_node=8 --nnodes=1 --node_rank=0 --master_addr="127.0.0.1" --master_port=12581 train.py configs/ms1mv3_r50_lr02
Node 0:
python -m torch.distributed.launch --nproc_per_node=8 --nnodes=2 --node_rank=0 --master_addr="ip1" --master_port=12581 train.py configs/webface42m_r100_lr01_pfc02_bs4k_16gpus
Node 1:
python -m torch.distributed.launch --nproc_per_node=8 --nnodes=2 --node_rank=1 --master_addr="ip1" --master_port=12581 train.py configs/webface42m_r100_lr01_pfc02_bs4k_16gpus
- MS1MV3 (93k IDs, 5.2M images)
- Glint360K (360k IDs, 17.1M images)
- WebFace42M (2M IDs, 42.5M images)
- This repo is mainly inspired by deepinsight/insightface
@article{sang2022interface,
title={InterFace: Adjustable Angular Margin Inter-class Loss for Deep Face Recognition},
author={Sang, Meng and Chen, Jiaxuan and Li, Mengzhen and Tan, Pan and Pan, Anning and Zhao, Shan and Yang, Yang},
journal={arXiv preprint arXiv:2210.02018},
year={2022}
}