FaceQgen
FaceQgen: Semi-Supervised Deep Learning for Face Image Quality Assessment
This repository is based on the paper: "FaceQgen: Semi-Supervised Deep Learning for Face Image Quality Assessment" presented in the IEEE International Conference on Automatic Face and Gesture Recognition 2021.
FaceQgen is a a face quality assessment method based on GANs capable of inferring quality directly from face images. It avoids using any type of numerical labelling of the training images thanks to following a semi-supervised learning approach without the need of a specific measurement of quality for its groundtruth apart from selecting a single high quality image per subject.
FaceQgen performs face image restoration, returning a high quality image (frontal pose, homogeneous background, etc.) when receiving a face image of unknown quality. We use three different similarity measures between the original and the restored images as quality measures: SSIM,MSE, and the output of the Discriminator of FaceQgen. Faces of high quality will experience less transformations during restoration, so the similarity values obtained in those cases will be higher than the ones obtained from low quality images.
The training of FaceQgen was done using the SCFace database.
-- Configuring environment in Windows:
Update Conda in the default environment:
conda update conda
conda upgrade --all
Create a new environment:
conda create -n [env-name]
Activate the environment:
conda activate [env-name]
- Installing dependencies in your environment:
Install Tensorflow and all its dependencies:
pip install tensorflow
Install Keras:
pip install keras
Install OpenCV:
conda install -c conda-forge opencv
- If you want to use a CUDA compatible GPU for faster predictions:
You will need CUDA and the Nvidia drivers installed in your computer: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/
Then, install the GPU version of Tensorflow:
pip install tensorflow-gpu
-- Using FaceQgen for predicting scores:
- Download or clone the repository.
- Due to the size of the video example, please download one of the the FaceQgen pretrained model and place the downloaded .h5 file it in the /src folder:
- Edit and run the FaceQgen_obtainscores_Keras.py script.
- You will need to change the folder from which the script will try to charge the face images. It is src/Samples_cropped by default.
- The best results will be obtained when the input images have been cropped just to the zone of the detected face. In our experiments we have used the MTCNN face detector from here, but other detector can be used.
- FaceQgen will ouput a quality score for each input image. All the scores will are saved in a .txt file into the src folder. This file contain each filename with its associated quality metric.