Skip to content

Latest commit

 

History

History
143 lines (108 loc) · 8.15 KB

README.zh-CN.md

File metadata and controls

143 lines (108 loc) · 8.15 KB
语言: 🇨🇳 🇺🇸

«YOLO5Face» 复现了论文 "YOLO5Face: Why Reinventing a Face Detector"

  1. YOLO5Face: Why Reinventing a Face Detector
  2. WIDER FACE: A Face Detection Benchmark

ONLINE DEMO:FACE AND LANDMARKS DETECT

ARCH GFLOPs Easy Medium Hard
zjykzj/YOLO5Face (This) yolov5s-face 15.2 94.69 93.00 84.73
deepcam-cn/yolov5-face(Official) yolov5s-face / 94.33 92.61 83.15
zjykzj/YOLO5Face (This) shufflenetv2-face 1.5 90.27 87.39 73.60
deepcam-cn/yolov5-face(Official) shufflenetv2-face / 90.76 88.12 73.82
zjykzj/YOLO5Face (This) yolov5x-v7.0 204 95.79 94.53 87.63
zjykzj/YOLO5Face (This) yolov5s-v7.0 15.8 94.84 93.28 84.67
zjykzj/YOLO5Face (This) yolov5n-v7.0 4.2 93.25 91.11 80.33

内容列表

新闻🚀🚀🚀

版本 发布日期 主要更新
v1.1.1 2024/08/17 更新YOLO5Face,新增Gradio demo。
v1.1.0 2024/07/21 支持更多模型,包括shufflenetv2-face/yolov5x-v7.0/yolov5n-v7.0。
v1.0.0 2024/07/14 增加关键点检测,实现人脸+关键点检测。
v0.1.0 2024/06/29 基于yolov5-v7.0和WIDERFACE数据集训练人脸检测器。

背景

YOLO5Face是一个很有趣的工作,它进一步抽象了人脸检测任务,直接采用通用目标检测算法就可以实现很好的人脸检测效果。当然它还实现了5点人脸关键点回归。 基于ultralytics/yolov5,YOLO5Face可以很方便的应用不同的模型和训练,比如采用轻量网络来实现实时检测,采用大网络来实现更高的检测精度。

注意:当前本仓库最新的实现完全基于ultralytics/yolov5 v7.0

安装

$ pip3 install -r requirements.txt

或者使用Docker Container

$ docker run -it --runtime nvidia --gpus=all --shm-size=16g -v /etc/localtime:/etc/localtime -v $(pwd):/workdir --workdir=/workdir --name yolo5face ultralytics/yolov5:v7.0

用法

下载WIDERFACE数据集:Baidu Drive(08p0)

训练

# yolov5s_v7.0
$ python3 widerface_train.py --data widerface.yaml --weights "" --cfg models/yolo5face/cfgs/yolov5s_v7_0.yaml --hyp models/yolo5face/hyps/hyp.scratch-low.yaml --img 800 --epoch 300 --device 0
# yolov5s-face
$ python3 widerface_train.py --data widerface.yaml --weights "" --cfg models/yolo5face/cfgs/yolov5s_face.yaml --hyp models/yolo5face/hyps/hyp.scratch.yaml --img 800 --epoch 300 --device 0

评估

$ python widerface_detect.py --weights ./runs/exp4-yolov5s_v7_0-i800-e300.pt --source ../datasets/widerface/images/val/ --folder_pict ../datasets/widerface/wider_face_split/wider_face_val_bbx_gt.txt --conf-thres 0.001 --iou-thres 0.6 --save-txt --save-conf --device 0
...
YOLOv5s_v7_0 summary: 157 layers, 7039792 parameters, 0 gradients, 15.8 GFLOPs
...
Speed: 0.4ms pre-process, 8.8ms inference, 0.8ms NMS per image at shape (1, 3, 640, 640)
Results saved to runs/detect/exp7
0 labels saved to runs/detect/exp7/labels
$ cd widerface_evaluate/
$ python3 evaluation.py -p ../runs/detect/exp7/labels/ -g ./ground_truth/
Reading Predictions : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 61/61 [00:00<00:00, 62.18it/s]
Processing easy: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 61/61 [00:20<00:00,  2.94it/s]
Processing medium: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 61/61 [00:20<00:00,  2.98it/s]
Processing hard: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 61/61 [00:20<00:00,  2.97it/s]
==================== Results ====================
Easy   Val AP: 0.9483604102331251
Medium Val AP: 0.9328484206418773
Hard   Val AP: 0.8467345083774318
=================================================

预测

$ python detect_face_and_landmarks.py --weights ./runs/exp4-yolov5s_v7_0-i800-e300.pt --source assets/selfie.jpg --imgsz 2048 --conf-thres 0.25 --iou-thres 0.45 --hide-labels --hide-conf

主要维护人员

  • zhujian - Initial work - zjykzj

致谢

参与贡献方式

欢迎任何人的参与!打开issue或提交合并请求。

注意:

许可证

Apache License 2.0 © 2024 zjykzj