File size: 3,176 Bytes
ff1446e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
---
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 setup.py build_ext --inplace
python evaluation.py #please modify the evaluation path
```
### Performance
| Model | easy | medium | hard |
|:-|:-:|:-:|:-:|
| RetinaFace_onnx_model (608x640) | 88.67% | 82.10% | 52.16% |
```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}
``` |