X光场景的目标检测之前的项目中做的比较少,今天工作结束后正好有点时间就想着把之前遗留的数据集应用起来,开发一个实际的项目,首先看下效果图:
简单看下数据集如下:
YOLO格式标注文件如下:
实例标注内容如下所示:
3 0.746044 0.293727 0.109177 0.085645
3 0.609968 0.217732 0.109177 0.083233
3 0.480222 0.212907 0.093354 0.08082
3 0.336234 0.256333 0.102848 0.083233
0 0.392405 0.183353 0.098101 0.077201
0 0.560918 0.116405 0.112342 0.095296
0 0.691456 0.115199 0.132911 0.109771
0 0.829114 0.227382 0.148734 0.095296
0 0.839399 0.486128 0.162975 0.127865
4 0.643196 0.369723 0.128165 0.095296
4 0.530854 0.331122 0.109177 0.095296
4 0.421677 0.326297 0.093354 0.092883
4 0.322785 0.351628 0.098101 0.083233
2 0.560918 0.588058 0.143987 0.109771
4 0.711234 0.534379 0.112342 0.101327
1 0.318829 0.442702 0.09019 0.139928
1 0.394778 0.426417 0.087025 0.119421
1 0.477848 0.415561 0.101266 0.104946
1 0.571994 0.442702 0.102848 0.098914
5 0.425633 0.711701 0.161392 0.190591
6 0.318829 0.716526 0.106013 0.15199
VOC格式标注文件如下所示:
实例标注内容如下所示:
JPEGImages
0bb6e995-3a11-42a5-990c-d041a4b0e1d6.png
0bb6e995-3a11-42a5-990c-d041a4b0e1d6.png
1514
2044
3
0
这里考虑到数据集整体比较规整,选择的是最为轻量级的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)
]
训练日志输出如下:
混淆矩阵:
F1值曲线:
PR曲线:
batch计算实例:
可视化推理样例如下: