Skip to content

Repository files navigation

Face Image Quality Assessment

Downloads License: MIT

Tip

The models and functionality in this repository are integrated into UniFace — an all-in-one face analysis toolkit.
PyPI Version GitHub Stars

PyTorch inference, ONNX export, and ONNX Runtime inference for eDifFIQA — a face image quality estimator that predicts a single quality score from an aligned 112×112 face. Uses UniFace for face detection and alignment.

Models

Variant Backbone Params Input PyTorch (.pth) ONNX
eDifFIQA-T MobileFaceNet 1.7M 112x112 Link Link
eDifFIQA-S IResNet-18 24.6M 112x112 Link Link
eDifFIQA-M IResNet-50 44.1M 112x112 Link Link
eDifFIQA-L IResNet-100 65.7M 112x112 Link Link

Higher score = better quality. Authors evaluate against 10 FIQA competitors on 7 static-image datasets + 1 video dataset using EDC curves; LFW and XQLFW are the commonly cited references for high-quality vs. low-quality regimes. eDifFIQA-L ranks first on the NIST FATE-Quality Kiosk-to-Entry track. See the paper for per-dataset numbers.

.pth weights are ported from the upstream authors' OneDrive folder; .onnx files are exported from those weights and mirrored to this repo's release.

Installation

pip install -r requirements.txt
bash download.sh

Demo

eDifFIQA-T quality scores on assets/test_images/. The same face, progressively degraded, gets a sharply lower score:

Original Down-up sampled Heavy blur

0.762

0.435

0.144

0.737

0.537

0.273

Inference

Inputs are aligned 112×112 face crops. Pass a full image and alignment is handled for you; use --aligned or score_aligned() to skip it for already-aligned crops.

PyTorch

python main.py assets/test_images/image2.jpg --variant s

Pre-aligned 112×112 crops:

python main.py --aligned aligned_face.jpg --variant s

ONNX

python onnx_inference.py --model weights/ediffiqa_s.onnx assets/test_images/image2.jpg
import cv2
from models import eDifFIQAOnnx
from uniface.detection import SCRFD

detector = SCRFD()
quality = eDifFIQAOnnx("weights/ediffiqa_s.onnx")

image = cv2.imread("image.jpg")
for face in detector.detect(image):
    score = quality.get_quality(image, face.landmarks)
    print(f"Quality: {score:.4f}")

ONNX Export

python onnx_export.py -v s -w weights/ediffiqa_s.pth -o weights/ediffiqa_s.onnx --dynamic

Reference

  • eDifFIQA — Original PyTorch implementation and paper
  • UniFace — Face detection and alignment

License

MIT License

About

eDifFIQA: Towards Efficient Face Image Quality Assessment Based on Denoising Diffusion Probabilistic Models

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages