当前位置:网站首页>Face and key point detection: yolo5face practice
Face and key point detection: yolo5face practice
2022-07-25 21:26:00 【Shaoji Bay】

Github:https://github.com/deepcam-cn/yolov5-face
Reading guide : It took a day to reproduce the project , Mainly in data set format , The author is actually train2yolo It's amazing that Widerface Training set (12000+ Pictures ) Save one by one , If you don't do this, you will report an error , The reason is that the data cache cannot be read . hamal , liver !
One 、 Settings
Step by step
Cloning of warehouse , Get into conda Environmental Science
git clone https://github.com/deepcam-cn/yolov5-face.git
conda activate pytorch-cifar
test model
Download the author's pre trained YOLO5m-face Model , And test the effect of a single picture . function detectface as follows :

"args": [
// // // to run train2yolo:
// "data/widerface/train",
// "data/widerface/train/labels"
// // // to run val2yolo:
// "data/widerface",
// "data/widerface/val/labels"
// // to run detect_face
// "--img-size", "640",
// "--weights", "weights/yolov5m-face.pt",
// to train on widerface
// "CUDA_VISIBLE_DEVICES"," 0, ",
"--data", "data/widerface.yaml",
"--cfg", "models/yolov5s.yaml",
"--weights", "weights/yolov5s.pt"
]
Above is launch.json Configuration parameters for , Corresponding to several tasks . In which operation train2yolo.py, Great slowness ; But I have to do .
Two 、 Training
2.1 Prepare the data :
Recommend going to the official website http://shuoyang1213.me/WIDERFACE/
download widerface Data sets , Download separately train、val、test Three bags . I refer to RetinaFace The data set downloaded is not comprehensive .
Because the official website did not find the annotation text of face key points , At the beginning git link YOLO5face You can download with keypoint Of annotation file . The whole file structure is as follows :
(base) [email protected]:NewProjects$ ln -s ~/Datasets/widerface yolov5-face/data/
//
yolov5-face
│ README.md
│ ...
│data
| └─widerface
│ └───test
| └───images
| └───labels
│ └───train
| └───images
| └───labels
| └───0..._1_5.jpg
| └───0..._1_5.txt
│ └───val
The catalogue is a little ugly , But for the sake of explanation , It's also hard work .
Download pre trained yolo5 Test model , Because the project is based on yolo The version is older ( newest 6.0 edition ) For a long time , Download link reference :
https://github.com/ultralytics/yolov5/releases/tag/v4.0
Accurately read the data path , stay widerface.yaml It is amended as follows :
train: /home/wqt/NewProjects/yolov5-face/data/widerface/train/labels
val: /home/wqt/NewProjects/yolov5-face/data/widerface/val/labels
# number of classes
nc: 1
# class names
names: [ 'face']
function train, No mistake , The Buddha bless !
autoanchor: Analyzing anchors... anchors/target = 4.02, Best Possible Recall (BPR) = 0.9997
Image sizes 800 train, 800 test
Using 4 dataloader workers
Logging results to runs/train/exp12
Starting training for 250 epochs...
Epoch gpu_mem box obj cls landmark total targets img_size
0/249 4.65G 0.1032 0.03953 0 0.1396 0.2823 25 800: 100%|███████████████████████████████████████████████| 801/801 [03:12<00:00, 4.16it/s]
Epoch gpu_mem box obj cls landmark total targets img_size
1/249 5.01G 0.08159 0.03674 0 0.02959 0.1479 15 800: 100%|███████████████████████████████████████████████| 801/801 [03:03<00:00, 4.38it/s]
Training was quite fast , One epoch Just a few minutes , common 250epoch.
of YOLO data format
The original widerface It is marked as follows :
0--Parade/0_Parade_marchingband_1_849.jpg
1
449 330 122 149 0 0 0 0 0 0
Turn into YOLO Format , as follows :
0--Parade/0_Parade_marchingband_1_849.jpg
449 330 122 149 488.906 373.643 0.0 542.089 376.442 0.0 515.031 412.83 0.0 485.174 425.893 0.0 538.357 431.491 0.0 0.82
namely :bbox (xywh) + (xi, yi, flag)
COCO keypoints Turn into YOLO Format (17 Key points of human body ), The marks corresponding to the following pictures are as follows :
0 0.686445 0.531960 0.082891 0.323967 0.667188 0.399061 1.000000 0.670312 0.396714 2.000000 0.000000 0.000000 0.000000 0.678125 0.394366 2.000000 0.000000 0.000000 0.000000 0.689063 0.415493 2.000000 0.696875 0.415493 2.000000 0.682813 0.469484 2.000000 0.671875 0.483568 2.000000 0.671875 0.516432 2.000000 0.656250 0.504695 2.000000 0.695312 0.530516 2.000000 0.706250 0.523474 2.000000 0.698438 0.610329 2.000000 0.709375 0.603286 2.000000 0.710938 0.680751 2.000000 0.717187 0.671362 2.000000

Trained 12h after , The measured results are as follows :
Epoch gpu_mem box obj cls landmark total targets img_size
249/249 5.01G 0.03923 0.02193 0 0.00727 0.06844 18 800:
Class Images Targets P R [email protected] [email protected]:.95:
all 3.22e+03 3.96e+04 0.576 0.723 0.715 0.34
That is to say WiderFace We got it [email protected]=71.5%,[email protected]=0.34
Actually measured 1:

Actually measured 2:
Use the zoom effect , There are still some errors in the detection , For example, the points on both sides of the corner of the mouth .
边栏推荐
- Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
- Stm3 (cubeide) lighting experiment
- 基于腾讯地图实现精准定位,实现微信小程序考勤打卡功能
- The role of the resize function is "suggestions collection"
- 零基础学习CANoe Panel(17)—— Panel CAPL Function
- Test cases and defect report templates
- How to copy all files in one folder to another folder
- Achieve accurate positioning based on Tencent map, and realize the attendance punch function of wechat applet
- 图片怎么存储到数据库里「建议收藏」
- An interview question combining defer and function in golang
猜你喜欢

Per capita Swiss number series, Swiss number 4 generation JS reverse analysis

【网络教程】IPtables官方教程--学习笔记2

Test cases and defect report templates

Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees

NVIDIA has opened source a comprehensive library of 3D deep learning based on pytorch
![[online tutorial] iptables official tutorial -- learning notes 2](/img/7d/5f8328d1b4c8878f17c95d2658d2d6.jpg)
[online tutorial] iptables official tutorial -- learning notes 2

Apple estimates that iPhone will give up the Chinese market, and the Chinese industrial chain needs to consider living a hard life

Debugged PEB (beingdebugged, ntglobalflag)

Decompile app

Airtest solves the problem that a password needs to be entered in the process of "automatic packaging" (the same applies to random bullet frame processing)
随机推荐
Stm3 (cubeide) lighting experiment
Explain the principle of MySQL master-slave replication in detail
ONEFLOW V0.8.0 officially released
How to automatically generate short chains? How to generate links with UTM parameters online in batches?
Huawei occupies half of the folding mobile phone market, proving its irreplaceable position in the high-end market
Byte side: can TCP and UDP use the same port?
Record the transfer of domain names from Alibaba cloud service providers to Huawei cloud
Use Navicat to connect to MySQL database through SSH channel (pro test is feasible)
Test cases and defect report templates
In June 2021, the interview suffered a Waterloo. Is it so convoluted now
Rent two or three things
Cesium polygon gradient texture (canvas)
Huatai Securities account opening process, is it safe to open an account on your mobile phone
C#程序设计的6大原则
Golang language quickly get started to comprehensive practical notes (go language, beego framework, high concurrency chat room, crawler)
[ManageEngine] value brought by Siem to enterprises
MPI学习笔记(二):矩阵相乘的两种实现方法
如何自动生成短链?如何在线批量生成带UTM参数的链接?
Airtest solves the problem that a password needs to be entered in the process of "automatic packaging" (the same applies to random bullet frame processing)
Niuke-top101-bm37