Processing pipeline for cropping, blurring and low-pass filtering of face images to reach less than 1kB.
In order to optimize image compression, most compression algorithms offer different settings for compression. The code in this repository was used to prepare images for face recognition and evaluate different settings. Please note that we did not write all code in this repository by ourself.
For getting this code to work, follow these steps:
- Download this repository.
- Download the Face Image Quality Toolkit
- Download the OFIQ-Project (this is a zmq-ready version of the original project)
- Follow the setup of the Face Image Quality Toolkit
- Follow the setup of the zmq-ready OFIQ-Project
- Download either C or T model for ViT-FIQA
- Create a record in the "local/fiqat.toml" file: [ofiq_path] "path/to/OFIQ-Project"
- Create a record in the "local/fiqat.toml" file: [cvlface] "path/where/data/will/be/placed"
- Install all the used compression algorithms (use the official repositories and follow the instructions there)
- Install the requirements.txt using pip
- Fill the paths in paths.py
- Fill your HuggingFace token and the path for the test image in adaface.py
- Create a new folder in optuna_cases named "dashboards"
After the setup is completed, datasets for compression can be created and different settings can be evaluated. Use the files in optuna_cases for this task.
The organisation of the images is intended as follows:
- The original dataset contains all images that are used for evaluation in .png format. It consists of a main folder, containing subfolders where each subfolder contains all images for one individual.
- The first steps should create datasets which are ready for compression.
- Compression-ready datasets should be organized by folders. First is color/gray, second is resolution, last is manipulation
- Example:
comrpession_ready_datasets/ |-- gray/ |-- color/ | |-- 56/ | |-- 80/ | |-- 112/ | | |-- default/ | | |-- rectangle_blur/ | | | |-- individual1/ | | | | |-- img_1.png | | | | |-- img_2.png | | | |-- individual2/ | | | | |-- img_1.png | | | | |-- img_2.png
For evaluating the different parameters the grid search for Optuna must be defined by uncommenting the different options. Parameters must then be provided to the compression. You can see in build_command.py how parameters must be named. In addition, the study names must be changed for each evaluation. If you want to see the results in a web-app, you may install optuna-dashboard library.
- Paul Andreas - main developer
- Torsten Schlett - supervisor, developer
- Prof. Dr. Christoph Busch - supervisor
We would like to express our gratitude to the developers and researchers behind the following open-source projects, which made this work possible:
- Optuna for the efficient and easy-to-use parameter optimization framework.
- CVLFace for the used face image feature extractor.
- ViT-FIQA for their work on face image quality assessment.
- InsightFace for the efficient and accurate face detection framework.
- OFIQ-Project for their contributions to standardized face image quality evaluation.
Their work has significantly contributed to the development and evaluation of this project. We sincerely appreciate their efforts in advancing open research and making these tools available to the community.
This repository itself is licensed under the MIT License.
Code in the vitfiqa directory was based on code taken from the ViT-FIQA repository, which is licensed under the terms of the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. The corresponding Python files are marked with a comment at the top of the file.
Functions in adaface.py and CVLface/cvlface.py derived from CVLface project code are marked with comments and the CVLface project repository uses the MIT License. Please also note the README of the corresponding pretrained model ("Please cite the original paper and follow the license of the training dataset.").
The code in helpers/create_edc.py and helpers/storage.py is a modified version taken from Face Image Quality Toolkit, which uses the MIT License.
finished