face image quality assessment ediffiqa

Provideropencv
Categoryimage-quality-assessment
LicenseApache-2.0
Downloads0
Stars0

Overview

EdiffiQA is a specialized image quality assessment (IQA) model integrated within the OpenCV ecosystem, designed specifically for face image analysis. Unlike general-purpose IQA tools, EdiffiQA focuses on the nuances of facial features to provide objective quality scores, making it ideal for preprocessing pipelines in facial recognition or biometric authentication systems. Developers can leverage it to automate the filtering of blurred, poorly lit, or low-resolution captures before they hit more computationally expensive inference stages. Because it is distributed via OpenCV, it offers a familiar integration path for C++ and Python developers, ensuring low-latency execution and easy deployment across cross-platform environments without the overhead of heavy deep learning frameworks.

Highlights

  • Optimized specifically for facial image quality scoring
  • Seamless integration via the OpenCV library
  • Ideal for biometric preprocessing and data filtering
  • Permissive Apache-2.0 license for commercial use
  • Low-latency performance for real-time quality checks

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("opencv/face_image_quality_assessment_ediffiqa")
tokenizer = AutoTokenizer.from_pretrained("opencv/face_image_quality_assessment_ediffiqa")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download opencv/face_image_quality_assessment_ediffiqa

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download opencv/face_image_quality_assessment_ediffiqa config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('opencv/face_image_quality_assessment_ediffiqa')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/opencv/face_image_quality_assessment_ediffiqa

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/opencv/face_image_quality_assessment_ediffiqa

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('opencv/face_image_quality_assessment_ediffiqa')
tokenizer = AutoTokenizer.from_pretrained('opencv/face_image_quality_assessment_ediffiqa')

Full Documentation

来源: HuggingFace

eDifFIQA(T)

eDifFIQA(T) is a light-weight version of the models presented in the paper eDifFIQA: Towards Efficient Face Image Quality Assessment based on Denoising Diffusion Probabilistic Models, it achieves state-of-the-art results in the field of face image quality assessment.

Notes:

  • The original implementation can be found here.
  • The included model combines a pretrained MobileFaceNet backbone, with a quality regression head trained using the proceedure presented in the original paper.
  • The model predicts quality scores of aligned face samples, where a higher predicted score corresponds to a higher quality of the input sample.
  • In the figure below we show the quality distribution on two distinct datasets: LFW[[1]](#1) and XQLFW[[2]](#2). The LFW dataset contains images of relatively high quality, whereas the XQLFW dataset contains images of variable quality. There is a clear difference between the two distributions, with high quality images from the LFW dataset receiving quality scores higher than 0.5, while the mixed images from XQLFW receive much lower quality scores on average.

!qualityDist

<a id="1">[1]</a>
B. Huang, M. Ramesh, T. Berg, and E. Learned-Miller
“Labeled Faces in the Wild: A Database for Studying Face Recognition in Unconstrained Environments”
University of Massachusetts, Amherst, Tech. Rep. 07-49,
October 2007.

<a id="2">[2]</a>
M. Knoche, S. Hormann, and G. Rigoll
“Cross-Quality LFW: A Database for Analyzing Cross-Resolution Image Face Recognition in Unconstrained Environments,” in Proceedings of the IEEE International Conference on Automatic Face and Gesture Recognition (FG), 2021, pp. 1–5.

Demo

*NOTE*: The provided demo uses ../face_detection_yunet for face detection, in order to properly align the face samples, while the original implementation uses a RetinaFace(ResNet50) model, which might cause some differences between the results of the two implementations.

To try the demo run the following commands:

shell
# Assess the quality of 'image1'
python demo.py -i /path/to/image1

Output all the arguments of the demo

python demo.py --help

Example outputs

!ediffiqaDemo

The demo outputs the quality of the sample via terminal (print) and via image in __results.jpg__.

License

All files in this directory are licensed under CC-BY-4.0.

Join our Telegram