YOLOv8-Pose关键点检测
✨✨✨手把手教你从数据标记到生成适合Yolov8-pose的yolo数据集;
🚀🚀🚀模型性能提升、pose模式部署能力;
🍉🍉🍉应用范围:工业工件定位、人脸、摔倒检测等支持各个关键点检测;
实时更新中,模型轻量化创新结果如下:
layers | parameters | GFLOPs | kb | mAP50 | mAP50-95 | |
---|---|---|---|---|---|---|
yolov8-pose | 187 | 3379496 | 9.6 | 6842 | 0.921 | 0.697 |
yolov8-C2f_GhostBottleneck-pose | 362 | 2590296 | 7.7 | 5393 | 0.929 | 0.769 |
yolov8-C2f_GhostBottleneckV2-pose | 298 | 2927192 | 8.3 | 5989 | 0.904 | 0.74 |
yolov8-C2f_repghost-pose | 334 | 2959784 | 8.4 | 6080 | 0.892 | 0.736 |
yolov8-C2f_g_ghostBottleneck-pose | 214 | 2954744 | 8.4 | 6022 | 0.932 | 0.71 |
yolov8-C2f_DCNV3-pose | 341 | 2895930 | 8.6 | 5970 | 0.926 | 0.743 |
yolov8-C2f_PConv-pose | 205 | 3018296 | 8.5 | 6134 | 0.925 | 0.695 |
yolov8-C2f_BiLevelRoutingAttention-pose | 205 | 3018296 | 8.5 | 6134 | 0.926 | 0.734 |
yolov8-C2f_ScConv-pose | 256 | 3188264 | 9 | 6479 | 0.921 | 0.7 |
yolov8-slimneck-pose | 309 | 3378200 | 8.9 | 6932 | 0.93 | 0.829 |
yolov8-C2f_RepvggOREPA-pose | 280 | 4565192 | 8.4 | 9359 | 0.915 | 0.677 |
yolov8-C2f_OREPA-pose | 196 | 4562504 | 8.2 | 9303 | 0.931 | 0.691 |
YOLOv8-C2f_LSKA_Attention-pose | 226 | 2987000 | 8.5 | 6080 | 0.925 | 0.652 |
yolov8-C2f_MultiDilatelocalAttention-pose | 250 | 3004472 | 8.5 | 6101 | 0.909 | 0.726 |
yolov8-pose_PPLCNet | 228 | 2223924 | 6.6 | 4574 | 0.901 | 0.752 |
YOLOv8-pose-EfficientRepBiPAN | 342 | 3055496 | 8.5 | 6302 | 0.912 | 0.779 |
数据集大小300张:训练集236张,验证集64张
关键点共21个
# 关键点的类别
keypoint_class = ['Ulna', 'Radius', 'FMCP','FPIP', 'FDIP', 'MCP5','MCP4', 'MCP3', 'MCP2','PIP5', 'PIP4', 'PIP3'
,'PIP2', 'MIP5', 'MIP4','MIP3', 'MIP2', 'DIP5','DIP4', 'DIP3', 'DIP2']
参考coco8-pose.yaml即可
# Ultralytics YOLO 🚀, AGPL-3.0 license
# COCO8-pose dataset (first 8 images from COCO train2017) by Ultralytics
# Example usage: yolo train data=coco8-pose.yaml
# parent
# ├── ultralytics
# └── datasets
# └── coco8-pose ← downloads here (1 MB)
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: ./ultralytics-7.31/data/hand_keypoint # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)
# Keypoints
kpt_shape: [21, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15,17,18,19,20]
# Classes
names:
0: hand
# Download script/URL (optional)
#download: https://ultralytics.com/assets/coco8-pose.zip
修改为21个关键点和一个类别nc:1
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv8-pose keypoints/pose estimation model. For Usage examples see https://docs.ultralytics.com/tasks/pose
# Parameters
nc: 1 # number of classes
kpt_shape: [21, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
scales: # model compound scaling constants, i.e. 'model=yolov8n-pose.yaml' will call yolov8-pose.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
s: [0.33, 0.50, 1024]
m: [0.67, 0.75, 768]
l: [1.00, 1.00, 512]
x: [1.00, 1.25, 512]
from ultralytics.yolo.cfg import entrypoint
arg="yolo pose train model=yolov8-pose.yaml data=ultralytics/cfg/datasets/hand_keypoint.yaml"
entrypoint(arg)
模型配置如下:
from n params module arguments
0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1]
22 [15, 18, 21] 1 1125538 ultralytics.nn.modules.head.Pose [1, [21, 3], [64, 128, 256]]
YOLOv8-pose summary: 250 layers, 3385074 parameters, 3385058 gradients, 9.7 GFLOPs
100个epoch以后
BoxPR_curve.png
PosePR_curve.png
预测图片结果如下:
存在部分关键点预测不准确的现象
优化教程如下:
🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
详见:
https://blog.csdn.net/m0_63774211/article/details/134174684
我正在参与2023腾讯技术创作特训营第三期有奖征文,组队打卡瓜分大奖!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有