# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple
width_multiple: 1.0 # 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] # from :来自哪一层的列表,number 某层重复的次数 ,module:对应的模块类,args: 模块类的参数。
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2 第0层 Conv (ch_in, ch_out, kernel, stride, padding, groups, dilation, activation) [64, 6, 2, 2] = ch_out, kernel, stride, padding
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4 1
[-1, 3, C3, [128]], #2 C3 (ch_in, ch_out, number, shortcut, groups, expansion) Bottleneck (ch_in, ch_out, shortcut, groups, expansion) [128] = ch_out 会嵌入一个number
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8 3
[-1, 6, C3, [256]], #4
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16 5
[-1, 9, C3, [512]], #6
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32 7
[-1, 3, C3, [1024]], #8
[-1, 1, SPPF, [1024, 5]], # 9 9 SPPF (ch_in, ch_out,k=(5, 9, 13)) [1024, 5] = ch_out,k
]
# YOLOv5 v6.0 head
head:
[[-1, 1, Conv, [512, 1, 1]], #10
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #11 nn.Upsample (size, scale_factor, mode, align_corners, name, recompute_scale_factor) [None, 2, 'nearest'] = size, scale_factor, mode
[[-1, 6], 1, Concat, [1]], # cat backbone P4 12 Concat (dimension) [1] = dimension
[-1, 3, C3, [512, False]], # 13 13 C3 (ch_in, ch_out, number, shortcut, groups, expansion) Bottleneck (ch_in, ch_out, shortcut, groups, expansion) [512, False] = ch_out, shortcut 会嵌入一个number
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8 3
[-1, 1, Conv, [256, 1, 1]], #14
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #15
[[-1, 4], 1, Concat, [1]], # cat backbone P3 16
[-1, 3, C3, [256, False]], # 17 (P3/8-small) 17
[-1, 1, Conv, [256, 3, 2]], #18
[[-1, 14], 1, Concat, [1]], # cat head P4 19
[-1, 3, C3, [512, False]], # 20 (P4/16-medium) #20
[-1, 1, Conv, [512, 3, 2]], #21
[[-1, 10], 1, Concat, [1]], # cat head P5 #22
[-1, 3, C3, [1024, False]], # 23 (P5/32-large) 23
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5) 24 Detect(nc=80, anchors=(), ch=()) [nc, anchors] = nc, anchors
]
翻译
搜索
复制