ONNX 模型库
返回模型

说明文档

在 WiderFace 上训练的 Retinaface 模型

Retinaface 在 WiderFace 数据集上以 640x640 分辨率训练,使用 mobilenet0.25 作为骨干网络。 该模型由 Jiankang Deng 等人在论文 RetinaFace: Single-stage Dense Face Localisation in the Wild 中提出。 我们使用的代码版本来自 这个仓库。

我们开发了一个修改版本,可以由 AMD Ryzen AI 支持。

模型描述

Retinaface 是一种用于人脸检测和面部关键点定位的先进算法。它基于深度学习技术,能够准确检测图像中的人脸并提供面部特征点的精确定位。

预期用途与限制

您可以使用原始模型进行人脸检测。请查看 模型中心 以获取所有可用的 Retinaface 模型。

如何使用

安装

按照 Ryzen AI 安装指南 为 Ryzen AI 准备环境。 运行以下脚本安装此模型的先决条件。

pip install -r requirements.txt 

数据准备(可选:用于精度评估)

  1. 下载 WIDERFACE 数据集。
  2. 按如下方式组织数据集目录: (注意:train 和 test 对于验证集上的精度评估不是必需的。wider_val.txt 仅包含 val 文件名,不包含标签信息。)
  ./data/widerface/
    val/
      images/
      wider_val.txt

测试与评估

  • 对单张图像运行推理
python widerface_onnx_inference.py  -m .\weights\RetinaFace_int.onnx --image_path \WIDERFACE_VAL_IMAGE_PAT --ipu --provider_config Path\To\vaip_config.json
#返回三个列表:boxes, confs, landms 
#如果您想更改图像路径,请从 widerface val 数据集中选择另一张图像,设置 --image_path  new_image_path

注意:vaip_config.json 位于 Ryzen AI 的安装包中(请参考 安装)

  • 测试量化模型的精度
  1. 生成 txt 文件
python widerface_onnx_evalute.py --ipu --provider_config Path\To\vaip_config.json
  1. 评估 txt 结果。示例来自 这里
cd ./widerface_evaluate
python evaluation.py #请修改评估路径

性能

模型 easy medium hard
RetinaFace_onnx_model (608x640) 88.55% 82.17% 52.21%
@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}

amd/retinaface

作者 amd

↓ 0 ♥ 12

创建时间: 2023-12-05 13:08:35+00:00

更新时间: 2024-03-29 09:41:07+00:00

在 Hugging Face 上查看

文件 (14)

.gitattributes
README.md
data/widerface/val/wider_val.txt
requirements.txt
utils.py
weights/RetinaFace_int.onnx ONNX
widerface_evaluate/box_overlaps.py
widerface_evaluate/evaluation.py
widerface_evaluate/ground_truth/wider_easy_val.mat
widerface_evaluate/ground_truth/wider_face_val.mat
widerface_evaluate/ground_truth/wider_hard_val.mat
widerface_evaluate/ground_truth/wider_medium_val.mat
widerface_onnx_evalute.py
widerface_onnx_inference.py