开发环境
电脑系统:Windows 10
语言环境:Python 3.8
编译器:Pycharm
深度学习环境:Pytorch 1.10.2
显卡及显存:NVIDIA GeForce GTX 3060+12G
CUDA版本: Release 11.3
数据集: coco128
一、任务
二、代码修改
1.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, C2, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 3, C3, [512]],
# [-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
# [-1, 3, C3, [1024]],
[-1, 1, SPPF, [512, 5]], # 9
]
2.header
代码如下(示例):
head:
[[-1, 1, Conv, [512, 3, 2]], #修改参数
[-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, 12], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
[-1, 1, Conv, [512, 3, 2]],
[[-1, 8], 1, Concat, [1]], # cat head P5ect(P3, P4, P5)
]
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
[[15, 18, 21], 1, Detect, [nc, anchors]], # 修改参数 Det
三、实验结果
总结
本次实验要修改两个模块,backbone模块和head模块。backbone模块需要去掉第七第八层,以后每一层的编号都发生了变化,还需要修改head模块的Detect层的参数