This repository contain inference code and pretrained models to use EdgeFace: Efficient Face Recognition Model for Edge Devices, which is the winning entry in the compact track of "EFaR 2023: Efficient Face Recognition Competition" organised for the IEEE/IAPR International Journal of Central Banking (IJCB) 2023. For the complete source code of training and evaluation, please check the official repository.
$ pip install -r requirements.txt
The following code shows how to use the model for inference:
import torch
from torchvision import transforms
from face_alignment import align
from backbones import get_model
# load model
model_name="edgeface_s_gamma_05" # or edgeface_xs_gamma_06
model=get_model(model_name)
checkpoint_path='path_to_checkpint'
model.load_state_dict(torch.load(checkpoint_path)['state_dict']).eval()
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
])
path = 'path_to_face_image'
aligned = align.get_aligned_face(path) # align face
transformed_input = transform(aligned) # preprocessing
# extract embedding
embedding = model(transformed_input)
- EdgeFace-s (gamma=0.5): available in
checkpoints/edgeface_s_gamma_05.pth
- EdgeFace-xs (gamma=0.6): available in
checkpoints/edgeface_xs_gamma_06.pth
The performance of each model is reported in Table 2 of the paper:
If you use this repository, please cite the following paper, which is published in the IEEE Transactions on Biometrics, Behavior, and Identity Science (IEEE T-BIOM). The PDF version of the paper is available as pre-print on arxiv. The complete source code for reproducing all experiments in the paper (including training and evaluation) is also publicly available in the official repository.
@article{edgeface,
title={Edgeface: Efficient face recognition model for edge devices},
author={George, Anjith and Ecabert, Christophe and Shahreza, Hatef Otroshi and Kotwal, Ketan and Marcel, Sebastien},
journal={IEEE Transactions on Biometrics, Behavior, and Identity Science},
year={2024}
}