Home
Softono
edgeface

edgeface

Open source Jupyter Notebook
156
Stars
27
Forks
3
Issues
3
Watchers
10 months
Last Commit

About edgeface

EdgeFace is an efficient face recognition model designed for edge devices, featuring a compact architecture suitable for resource-constrained environments. Published in IEEE T-BIOM (2024), it won the compact track of the IJCB 2023 Efficient Face Recognition Competition. The repository provides inference code and pretrained models for generating face embeddings from aligned face images. EdgeFace is available in multiple variants including base, small (s), extra small (xs), and ultra small (xxs), ranging from 18.23M to 1.24M parameters with computational costs from 1398 to 94 MFLOPs. Quantized versions with reduced storage are also available. Performance benchmarks show strong accuracy across standard datasets including LFW (99.57-99.83%), CALFW (94.83-96.07%), CPLFW (90.27-93.75%), CFP-FP (93.63-97.01%), and AgeDB30 (94.92-97.60%), demonstrating effective trade-offs between model size and recognition accuracy. Models can be loaded via PyTorch hub for easy integration. The implementation supports face alignment

Platforms

Web Self-hosted

Languages

Jupyter Notebook

Links

EdgeFace: Efficient Face Recognition Model for Edge Devices

arXiv HF-Demo HF-Model

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 at the IEEE International Joint Conference on Biometrics (IJCB) 2023. For the complete source code of training and evaluation, please check the official repository.

EdgeFace

Installation

$ pip install -r requirements.txt

Inference

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=f'checkpoints/{arch}.pt'
model.load_state_dict(torch.load(checkpoint_path, map_location='cpu')).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)

Pre-trained models

Performance

The performance of each model is reported in Table 2 of the paper:

performance

:rocket: New! Using EdgeFace Models via torch.hub

Available Models on torch.hub

  • edgeface_base
  • edgeface_s_gamma_05
  • edgeface_xs_q
  • edgeface_xs_gamma_06
  • edgeface_xxs
  • edgeface_xxs_q

NOTE: Models with _q are quantised and require less storage.

Loading EdgeFace Models with torch.hub

You can load the models using torch.hub as follows:

import torch
model = torch.hub.load('otroshi/edgeface', 'edgeface_xs_gamma_06', source='github', pretrained=True)
model.eval()

Performance benchmarks of different variants of EdgeFace

Model MPARAMS MFLOPs LFW(%) CALFW(%) CPLFW(%) CFP-FP(%) AgeDB30(%)
edgeface_base 18.23 1398.83 99.83 ± 0.24 96.07 ± 1.03 93.75 ± 1.16 97.01 ± 0.94 97.60 ± 0.70
edgeface_s_gamma_05 3.65 306.12 99.78 ± 0.27 95.55 ± 1.05 92.48 ± 1.42 95.74 ± 1.09 97.03 ± 0.85
edgeface_xs_gamma_06 1.77 154.00 99.73 ± 0.35 95.28 ± 1.37 91.58 ± 1.42 94.71 ± 1.07 96.08 ± 0.95
edgeface_xxs 1.24 94.72 99.57 ± 0.33 94.83 ± 0.98 90.27 ± 0.93 93.63 ± 0.99 94.92 ± 1.15

Reference

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}
}