|
--- |
|
license: apache-2.0 |
|
datasets: |
|
- wider_face |
|
tags: |
|
- RyzenAI |
|
- Object Detection |
|
- Computer Vision |
|
- Face |
|
- WiderFace |
|
- MobileNet |
|
- RetinaNet |
|
- ONNX |
|
--- |
|
|
|
# Retinaface model trained on WiderFace |
|
|
|
Retinaface trained on WiderFace dataset at resolution 640x640, when Retinaface use mobilenet0.25 as backbone net. |
|
It was introduced in the paper [RetinaFace: Single-stage Dense Face Localisation in the Wild](https://arxiv.org/abs/1905.00641) by Jiankang Deng et al. |
|
The code version we use from [this repository](https://github.com/biubug6/Pytorch_Retinaface.git). |
|
|
|
We develop a modified version that could be supported by [AMD Ryzen AI](https://ryzenai.docs.amd.com). |
|
|
|
|
|
## Model description |
|
|
|
Retinaface is an advanced algorithm used for face detection and facial keypoint localization. It is based on deep learning techniques and is capable of accurately detecting faces in images and providing precise positioning of facial landmarks. |
|
|
|
|
|
## Intended uses & limitations |
|
|
|
You can use the raw model for Face detection. See the [model hub](https://huggingface.co/models?sort=trending&search=amd%2FRetinaface) to look for all available Retinaface models. |
|
|
|
|
|
## How to use |
|
|
|
### Installation |
|
|
|
Follow [Ryzen AI Installation](https://ryzenai.docs.amd.com/en/latest/inst.html) to prepare the environment for Ryzen AI. |
|
Run the following script to install pre-requisites for this model. |
|
```bash |
|
pip install -r requirements.txt |
|
``` |
|
|
|
|
|
### Data Preparation (optional: for accuracy evaluation) |
|
1. Download the [WIDERFACE](http://shuoyang1213.me/WIDERFACE/index.html) dataset. |
|
2. Organise the dataset directory as follows: |
|
(Note: `train` and `test` are not necessary for accuracy evaluation on validation set. wider_val.txt only include val file names but not label information.) |
|
```Shell |
|
./data/widerface/ |
|
val/ |
|
images/ |
|
wider_val.txt |
|
``` |
|
|
|
### Test & Evaluation |
|
- Run inference for a single image |
|
```python |
|
python widerface_onnx_inference.py -m .\weights\RetinaFace_int.onnx --image_path \WIDERFACE_VAL_IMAGE_PAT --ipu --provider_config Path\To\vaip_config.json |
|
#return three lists: boxes, confs, landms |
|
#if you want to change the image path, please select another image from widerface val dataset, set --image_path new_image_path |
|
``` |
|
*Note: __vaip_config.json__ is located at the setup package of Ryzen AI (refer to [Installation](#installation))* |
|
|
|
- Test accuracy of the quantized model |
|
1. Generate txt file |
|
```python |
|
python widerface_onnx_evalute.py --ipu --provider_config Path\To\vaip_config.json |
|
``` |
|
2. Evaluate txt results. Demo come from [Here](https://github.com/wondervictor/WiderFace-Evaluation) |
|
```Shell |
|
cd ./widerface_evaluate |
|
python evaluation.py #please modify the evaluation path |
|
``` |
|
|
|
### Performance |
|
| Model | easy | medium | hard | |
|
|:-|:-:|:-:|:-:| |
|
| RetinaFace_onnx_model (608x640) | 88.55% | 82.17% | 52.21% | |
|
|
|
|
|
```bibtex |
|
@inproceedings{deng2019retinaface, |
|
title={RetinaFace: Single-stage Dense Face Localisation in the Wild}, |
|
author={Deng, Jiankang and Guo, Jia and Yuxiang, Zhou and Jinke Yu and Irene Kotsia and Zafeiriou, Stefanos}, |
|
booktitle={arxiv}, |
|
year={2019} |
|
``` |