deepcam-cn/yolov5-face

YOLO5Face: Why Reinventing a Face Detector (https://arxiv.org/abs/2105.12931) ECCV Workshops 2022)

Python

2,411

125 commits

updated Jul 22, 2024

See the code

README

What's New

2024.04 ncnn-android-yolov8-face

2023.04 yolov8-face (🔥🔥🔥↑)

2022.10 yolov7-face (🔥🔥🔥↑)

2022.8: yolov7

MethodTest SizeEasyMediumHardFLOPs (B) @640
yolov7-lite-t64088.785.271.50.8
yolov7-lite-s64092.789.978.53.0
yolov7-tiny64094.792.682.113.2
yolov7s64094.893.185.216.8
yolov764096.995.588.0103.4
yolov7+TTA64097.295.887.7103.4

2021.12: Yolov5-face to TensorRT.

BackbonePytorch(ms)TensorRT_FP16(ms)
yolov5n-0.57.72.1
yolov5n-face7.72.4
yolov5s-face5.62.2
yolov5m-face9.93.3
yolov5l-face15.94.5

Pytorch=1.10.0+cu102 TensorRT=8.2.0.6 Hardware=rtx2080ti

2021.11: BlazeFace

Methodmulti scaleEasyMediumHardModel Size(MB)Link
BlazeFaceTure88.585.573.10.472https://github.com/PaddlePaddle/PaddleDetection
BlazeFace-FPN-SSHTure90.788.379.30.479https://github.com/PaddlePaddle/PaddleDetection
yolov5-blazefaceTrue90.488.778.00.493https://pan.baidu.com/s/1RHp8wa615OuDVhsO-qrMpQ pwd:r3v3 https://drive.google.com/file/d/1adi6ke2vCLQFcpbvFqWo_J4wZIfPqSMG
yolov5-blazeface-fpnTrue90.889.479.10.493-

2021.08: Add new training dataset Multi-Task-Facial,improve large face detection.

MethodEasyMediumHard
YOLOv5s94.5692.9283.84
YOLOv5m95.4693.8785.54

QQ Group: 1164802745

Introduction

Yolov5-face is a real-time,high accuracy face detection.

Performance

Single Scale Inference on VGA resolution(max side is equal to 640 and scale).

Large family

MethodBackboneEasyMediumHard#Params(M)#Flops(G)
DSFD (CVPR19)ResNet15294.2991.4771.39120.06259.55
RetinaFace (CVPR20)ResNet5094.9291.9064.1729.5037.59
HAMBox (CVPR20)ResNet5095.2793.7676.7530.2443.28
TinaFace (Arxiv20)ResNet5095.6194.2581.4337.98172.95
SCRFD-34GF(Arxiv21)Bottleneck Res96.0694.9285.299.8034.13
SCRFD-10GF(Arxiv21)Basic Res95.1693.8783.053.869.98
-------
YOLOv5sCSPNet94.6792.7583.037.0755.751
YOLOv5s6CSPNet95.4893.6682.812.3866.280
YOLOv5mCSPNet95.3093.7685.2821.06318.146
YOLOv5m6CSPNet95.6694.185.235.48519.773
YOLOv5lCSPNet95.7894.3086.1346.62741.607
YOLOv5l6CSPNet96.3894.9085.8876.67445.279

Small family

MethodBackboneEasyMediumHard#Params(M)#Flops(G)
RetinaFace (CVPR20MobileNet0.2587.7881.1647.320.440.802
FaceBoxes (IJCB17)76.1757.1724.181.010.275
SCRFD-0.5GF(Arxiv21)Depth-wise Conv90.5788.1268.510.570.508
SCRFD-2.5GF(Arxiv21)Basic Res93.7892.1677.870.672.53
-------
YOLOv5nShuffleNetv293.7491.5480.321.7262.111
YOLOv5n-0.5ShuffleNetv290.7688.1273.820.4470.571

Pretrained-Models

Data preparation

  1. Download WIDERFace datasets.
  2. Download annotation files from google drive.
cd data
python3 train2yolo.py /path/to/original/widerface/train [/path/to/save/widerface/train]
python3 val2yolo.py  /path/to/original/widerface [/path/to/save/widerface/val]

Training

CUDA_VISIBLE_DEVICES="0,1,2,3" python3 train.py --data data/widerface.yaml --cfg models/yolov5s.yaml --weights 'pretrained models'

WIDERFace Evaluation

python3 test_widerface.py --weights 'your test model' --img-size 640

cd widerface_evaluate
python3 evaluation.py

Test

Landmark Visulization

First row: RetinaFace, 2nd row: YOLOv5m-Face YOLO5Face was used in the 3rd place standard face recogntion track of the ICCV2021 Masked Face Recognition Challenge.

AXera demo

https://github.com/AXERA-TECH/ax-samples/blob/main/examples/ax_yolov5s_face_steps.cc

Android demo

https://github.com/FeiGeChuanShu/ncnn_Android_face/tree/main/ncnn-android-yolov5_face

OpenCV DNN demo

https://github.com/hpc203/yolov5-face-landmarks-opencv-v2

ONNXRuntime/MNN/TNN/NCNN C++ demo

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/ort/cv/yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/mnn/cv/mnn_yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/tnn/cv/tnn_yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/ncnn/cv/ncnn_yolo5face.cpp

References

https://github.com/ultralytics/yolov5

https://github.com/DayBreak-u/yolo-face-with-landmark

https://github.com/xialuxi/yolov5_face_landmark

https://github.com/biubug6/Pytorch_Retinaface

https://github.com/deepinsight/insightface

Citation

  • If you think this work is useful for you, please cite

    @article{YOLO5Face,
    title = {YOLO5Face: Why Reinventing a Face Detector},
    author = {Delong Qi and Weijun Tan and Qi Yao and Jingfeng Liu},
    booktitle = {ArXiv preprint ArXiv:2105.12931},
    year = {2021}
    }
    
arcface
blazeface
pytorch
retinaface
scrfd
shufflenet
tensorrt
tinaface
yolo
yolov5
yolov7

deepcam-cn/yolov5-face

YOLO5Face: Why Reinventing a Face Detector (https://arxiv.org/abs/2105.12931) ECCV Workshops 2022)

Python

2,411

125 commits

updated Jul 22, 2024

See the code

README

What's New

2024.04 ncnn-android-yolov8-face

2023.04 yolov8-face (🔥🔥🔥↑)

2022.10 yolov7-face (🔥🔥🔥↑)

2022.8: yolov7

MethodTest SizeEasyMediumHardFLOPs (B) @640
yolov7-lite-t64088.785.271.50.8
yolov7-lite-s64092.789.978.53.0
yolov7-tiny64094.792.682.113.2
yolov7s64094.893.185.216.8
yolov764096.995.588.0103.4
yolov7+TTA64097.295.887.7103.4

2021.12: Yolov5-face to TensorRT.

BackbonePytorch(ms)TensorRT_FP16(ms)
yolov5n-0.57.72.1
yolov5n-face7.72.4
yolov5s-face5.62.2
yolov5m-face9.93.3
yolov5l-face15.94.5

Pytorch=1.10.0+cu102 TensorRT=8.2.0.6 Hardware=rtx2080ti

2021.11: BlazeFace

Methodmulti scaleEasyMediumHardModel Size(MB)Link
BlazeFaceTure88.585.573.10.472https://github.com/PaddlePaddle/PaddleDetection
BlazeFace-FPN-SSHTure90.788.379.30.479https://github.com/PaddlePaddle/PaddleDetection
yolov5-blazefaceTrue90.488.778.00.493https://pan.baidu.com/s/1RHp8wa615OuDVhsO-qrMpQ pwd:r3v3 https://drive.google.com/file/d/1adi6ke2vCLQFcpbvFqWo_J4wZIfPqSMG
yolov5-blazeface-fpnTrue90.889.479.10.493-

2021.08: Add new training dataset Multi-Task-Facial,improve large face detection.

MethodEasyMediumHard
YOLOv5s94.5692.9283.84
YOLOv5m95.4693.8785.54

QQ Group: 1164802745

Introduction

Yolov5-face is a real-time,high accuracy face detection.

Performance

Single Scale Inference on VGA resolution(max side is equal to 640 and scale).

Large family

MethodBackboneEasyMediumHard#Params(M)#Flops(G)
DSFD (CVPR19)ResNet15294.2991.4771.39120.06259.55
RetinaFace (CVPR20)ResNet5094.9291.9064.1729.5037.59
HAMBox (CVPR20)ResNet5095.2793.7676.7530.2443.28
TinaFace (Arxiv20)ResNet5095.6194.2581.4337.98172.95
SCRFD-34GF(Arxiv21)Bottleneck Res96.0694.9285.299.8034.13
SCRFD-10GF(Arxiv21)Basic Res95.1693.8783.053.869.98
-------
YOLOv5sCSPNet94.6792.7583.037.0755.751
YOLOv5s6CSPNet95.4893.6682.812.3866.280
YOLOv5mCSPNet95.3093.7685.2821.06318.146
YOLOv5m6CSPNet95.6694.185.235.48519.773
YOLOv5lCSPNet95.7894.3086.1346.62741.607
YOLOv5l6CSPNet96.3894.9085.8876.67445.279

Small family

MethodBackboneEasyMediumHard#Params(M)#Flops(G)
RetinaFace (CVPR20MobileNet0.2587.7881.1647.320.440.802
FaceBoxes (IJCB17)76.1757.1724.181.010.275
SCRFD-0.5GF(Arxiv21)Depth-wise Conv90.5788.1268.510.570.508
SCRFD-2.5GF(Arxiv21)Basic Res93.7892.1677.870.672.53
-------
YOLOv5nShuffleNetv293.7491.5480.321.7262.111
YOLOv5n-0.5ShuffleNetv290.7688.1273.820.4470.571

Pretrained-Models

Data preparation

  1. Download WIDERFace datasets.
  2. Download annotation files from google drive.
cd data
python3 train2yolo.py /path/to/original/widerface/train [/path/to/save/widerface/train]
python3 val2yolo.py  /path/to/original/widerface [/path/to/save/widerface/val]

Training

CUDA_VISIBLE_DEVICES="0,1,2,3" python3 train.py --data data/widerface.yaml --cfg models/yolov5s.yaml --weights 'pretrained models'

WIDERFace Evaluation

python3 test_widerface.py --weights 'your test model' --img-size 640

cd widerface_evaluate
python3 evaluation.py

Test

Landmark Visulization

First row: RetinaFace, 2nd row: YOLOv5m-Face YOLO5Face was used in the 3rd place standard face recogntion track of the ICCV2021 Masked Face Recognition Challenge.

AXera demo

https://github.com/AXERA-TECH/ax-samples/blob/main/examples/ax_yolov5s_face_steps.cc

Android demo

https://github.com/FeiGeChuanShu/ncnn_Android_face/tree/main/ncnn-android-yolov5_face

OpenCV DNN demo

https://github.com/hpc203/yolov5-face-landmarks-opencv-v2

ONNXRuntime/MNN/TNN/NCNN C++ demo

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/ort/cv/yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/mnn/cv/mnn_yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/tnn/cv/tnn_yolo5face.cpp

https://github.com/DefTruth/lite.ai.toolkit/blob/main/lite/ncnn/cv/ncnn_yolo5face.cpp

References

https://github.com/ultralytics/yolov5

https://github.com/DayBreak-u/yolo-face-with-landmark

https://github.com/xialuxi/yolov5_face_landmark

https://github.com/biubug6/Pytorch_Retinaface

https://github.com/deepinsight/insightface

Citation

  • If you think this work is useful for you, please cite

    @article{YOLO5Face,
    title = {YOLO5Face: Why Reinventing a Face Detector},
    author = {Delong Qi and Weijun Tan and Qi Yao and Jingfeng Liu},
    booktitle = {ArXiv preprint ArXiv:2105.12931},
    year = {2021}
    }
    
arcface
blazeface
pytorch
retinaface
scrfd
shufflenet
tensorrt
tinaface
yolo
yolov5
yolov7

Project health

Latest release

0.0.2 · Dec 20, 2025

Releases this year

2

Significant stargazers

Shangchen Zhou

1,502 followers · starred Jul 2022

Anandesh Sharma

34 followers · starred Feb 2025