在前文中基于X光手部骨骼数据开发构建了目标检测应用,这里主要是基于同样的数据集尝试开发构建实例分割系统,因为本身yolov5目前已经内置支持了实例分割应用,话不多说,直接来看效果图:
数据集跟前文一样这里就不再多介绍了,这里标注内容已经变成了实例分割所需要的标注形式,如下:
1 0.42602377807133424 0.7544031311154599 0.42602377807133424 0.901174168297456 0.5792602377807133 0.901174168297456 0.5792602377807133 0.7544031311154599
0 0.31638044914134744 0.7363013698630136 0.31638044914134744 0.8918786692759295 0.42800528401585203 0.8918786692759295 0.42800528401585203 0.7363013698630136
2 0.5521796565389696 0.5900195694716243 0.5521796565389696 0.7015655577299413 0.7278731836195509 0.7015655577299413 0.7278731836195509 0.5900195694716243
4 0.6889035667107001 0.46673189823874756 0.6889035667107001 0.5689823874755382 0.8236459709379128 0.5689823874755382 0.8236459709379128 0.46673189823874756
4 0.5462351387054161 0.3047945205479452 0.5462351387054161 0.4315068493150685 0.6571994715984147 0.4315068493150685 0.6571994715984147 0.3047945205479452
4 0.42932628797886396 0.3047945205479452 0.42932628797886396 0.44080234833659493 0.5488771466314399 0.44080234833659493 0.5488771466314399 0.3047945205479452
4 0.332892998678996 0.3385518590998043 0.332892998678996 0.487279843444227 0.42932628797886396 0.487279843444227 0.42932628797886396 0.3385518590998043
4 0.23381770145310435 0.41829745596868884 0.23381770145310435 0.5161448140900196 0.32694848084544254 0.5161448140900196 0.32694848084544254 0.41829745596868884
5 0.7443857331571995 0.3272994129158513 0.7443857331571995 0.476027397260274 0.8883751651254954 0.476027397260274 0.8883751651254954 0.3272994129158513
5 0.5581241743725232 0.0958904109589041 0.5581241743725232 0.23385518590998042 0.7140026420079261 0.23385518590998042 0.7140026420079261 0.0958904109589041
5 0.4081902245706737 0.08463796477495107 0.4081902245706737 0.20694716242661448 0.5429326287978864 0.20694716242661448 0.5429326287978864 0.08463796477495107
5 0.26420079260237783 0.14285714285714285 0.26420079260237783 0.2583170254403131 0.38110964332893 0.2583170254403131 0.38110964332893 0.14285714285714285
5 0.12549537648612946 0.25587084148727984 0.12549537648612946 0.36056751467710374 0.22192866578599735 0.36056751467710374 0.22192866578599735 0.25587084148727984
6 0.17965653896961692 0.3693737769080235 0.17965653896961692 0.436399217221135 0.2608982826948481 0.436399217221135 0.2608982826948481 0.3693737769080235
6 0.2846763540290621 0.28033268101761255 0.2846763540290621 0.363013698630137 0.404887714663144 0.363013698630137 0.404887714663144 0.28033268101761255
6 0.42932628797886396 0.23385518590998042 0.42932628797886396 0.30724070450097846 0.5548216644649934 0.30724070450097846 0.5548216644649934 0.23385518590998042
6 0.5548216644649934 0.22700587084148727 0.5548216644649934 0.31409001956947163 0.6809775429326288 0.31409001956947163 0.6809775429326288 0.22700587084148727
3 0.2846763540290621 0.487279843444227 0.2846763540290621 0.6095890410958904 0.37780713342140027 0.6095890410958904 0.37780713342140027 0.487279843444227
3 0.35997357992073975 0.45841487279843446 0.35997357992073975 0.576320939334638 0.43527080581241745 0.576320939334638 0.43527080581241745 0.45841487279843446
3 0.4227212681638045 0.41829745596868884 0.4227212681638045 0.5606653620352251 0.5217965653896962 0.5606653620352251 0.5217965653896962 0.41829745596868884
3 0.5250990752972259 0.4070450097847358 0.5250990752972259 0.5631115459882583 0.6089828269484808 0.5631115459882583 0.6089828269484808 0.4070450097847358
这里使用到的同样是最轻量级的n系列的模型与前文保持了一致,如下:
# YOLOv5 by Ultralytics, GPL-3.0 license
# Parameters
nc: 7 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.25 # layer channel multiple
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
# YOLOv5 v6.0 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, C3, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 6, C3, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, C3, [512]],
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 3, C3, [1024]],
[-1, 1, SPPF, [1024, 5]], # 9
]
# YOLOv5 v6.0 head
head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13
[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
[-1, 1, Conv, [256, 3, 2]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
[-1, 1, Conv, [512, 3, 2]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
]
这里默认执行了300epoch的迭代计算,如下:
结果详情如下:
F1值曲线:
PR曲线:
混淆矩阵
训练可视化:
数据可视化:
Batch实例:
可视化实例推理如下: