YOLOv7网络模型解读
·
# parameters
nc: 10 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
# anchors
anchors:
- [12,16, 19,36, 40,28] # P3/8
- [36,75, 76,55, 72,146] # P4/16
- [142,110, 192,243, 459,401] # P5/32
# yolov7 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Conv, [32, 3, 1]], # 0 [3,640,640]——>[32,640,640]
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2 [32,640,640]——>[64,320,320]主干网络第1层二倍的下采样
[-1, 1, Conv, [64, 3, 1]], #2 [64,320,320]——>[64,320,320]
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4 [64,320,320]——>[128,160,160]主干网络第3层二倍下采样
[-1, 1, Conv, [64, 1, 1]], #4 [128,160,160]——>[64,160,160] 压缩通道数
[-2, 1, Conv, [64, 1, 1]], #5 [128,160,160]——>[64,160,160] 压缩通道数
[-1, 1, Conv, [64, 3, 1]], #6 [64,160,160]——>[64,160,160]??
[-1, 1, Conv, [64, 3, 1]], #7 [64,160,160]——>[64,160,160]??
[-1, 1, Conv, [64, 3, 1]], #8 [64,160,160]——>[64,160,160]??
[-1, 1, Conv, [64, 3, 1]], #9 [128,160,160]——>[64,160,160]??
[[-1, -3, -5, -6], 1, Concat, [1]], # 10 将9、7、4、5层concat,输出[256,160,160]
[-1, 1, Conv, [256, 1, 1]], # 11 [256,160,160]——>[256,160,160]融合信息
[-1, 1, MP, []], #12 [256,160,160]——>[256,80,80] 最大池化和卷积的并行结构,二倍下采样
[-1, 1, Conv, [128, 1, 1]], #13 [256,80,80]——>[128,80,80] 压缩通道数
[-3, 1, Conv, [128, 1, 1]], #14 [256,160,160]——>[128,160,160] 压缩通道数
[-1, 1, Conv, [128, 3, 2]], #15 [128,160,160]——>[128,80,80] 主干网络第15层二倍下采样
[[-1, -3], 1, Concat, [1]], # 16-P3/8 将15、13层concat,输出[256,80,80]
[-1, 1, Conv, [128, 1, 1]], #17 [256,80,80]——>[128,80,80] 压缩通道数
[-2, 1, Conv, [128, 1, 1]], #18 [256,80,80]——>[128,80,80] 压缩通道数
[-1, 1, Conv, [128, 3, 1]], #19 [128,80,80]——>[128,80,80]
[-1, 1, Conv, [128, 3, 1]], #20 [128,80,80]——>[128,80,80]
[-1, 1, Conv, [128, 3, 1]], #21 [128,80,80]——>[128,80,80]
[-1, 1, Conv, [128, 3, 1]], #22 [128,80,80]——>[128,80,80]
[[-1, -3, -5, -6], 1, Concat, [1]], #23 将22、20、18、17层concat,输出[512,80,80] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [512, 1, 1]], # 24 [512,80,80]——>[512,80,80] 横向连接
[-1, 1, MP, []], #25 [512,80,80]——>[512,40,40] 最大池化和卷积的并行结构,二倍下采样
[-1, 1, Conv, [256, 1, 1]], #26 [512,40,40]——>[256,40,40]压缩通道数
[-3, 1, Conv, [256, 1, 1]], #27 [512,80,80]——>[256,80,80]压缩通道数
[-1, 1, Conv, [256, 3, 2]], #28 [256,80,80]——>[256,40,40]主干网络第28层二倍下采样
[[-1, -3], 1, Concat, [1]], # 29-P4/16 将28、26层concat,输出[512,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [256, 1, 1]], #30 [512,40,40]——>[256,40,40]压缩通道数
[-2, 1, Conv, [256, 1, 1]], #31 [512,40,40]——>[256,40,40]压缩通道数
[-1, 1, Conv, [256, 3, 1]], #32 [256,40,40]——>[256,40,40]
[-1, 1, Conv, [256, 3, 1]], #33 [256,40,40]——>[256,40,40]
[-1, 1, Conv, [256, 3, 1]], #34 [256,40,40]——>[256,40,40]
[-1, 1, Conv, [256, 3, 1]], #35 [256,40,40]——>[256,40,40]
[[-1, -3, -5, -6], 1, Concat, [1]], #36 将35、33、31、30层concat,输出[1024,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [1024, 1, 1]], # 37 [1024,40,40]——>[1024,40,40] 横向连接
[-1, 1, MP, []], #38 [1024,40,40]——>[1024,20,20] 最大池化和卷积的并行结构,二倍下采样 采用默认参数
[-1, 1, Conv, [512, 1, 1]], #39 [1024,20,20]——>[512,20,20] 压缩通道数
[-3, 1, Conv, [512, 1, 1]], #40 [1024,40,40]——>[512,40,40] 压缩通道数
[-1, 1, Conv, [512, 3, 2]], #41 [512,40,40]——>[512,20,20]主干网络第41层二倍下采样
[[-1, -3], 1, Concat, [1]], # 42-P5/32 将41、39层concat,输出[1024,20,20]
[-1, 1, Conv, [256, 1, 1]], #43 [1024,20,20]——>[512,20,20] 压缩通道数
[-2, 1, Conv, [256, 1, 1]], #44 [1024,20,20]——>[512,20,20] 压缩通道数
[-1, 1, Conv, [256, 3, 1]], #45 [512,20,20]——>[512,20,20]
[-1, 1, Conv, [256, 3, 1]], #46 [512,20,20]——>[512,20,20]
[-1, 1, Conv, [256, 3, 1]], #47 [512,20,20]——>[512,20,20]
[-1, 1, Conv, [256, 3, 1]], #48 [512,20,20]——>[512,20,20]
[[-1, -3, -5, -6], 1, Concat, [1]], #49 将38、36、34、33层concat,输出[2048,20,20] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [1024, 1, 1]], # 50 [2048,20,20]——>[1024,20,20] 压缩通道数 横向连接
]
# yolov7 head
head:
[[-1, 1, SPPCSPC, [512]], # 51 [1024,20,20]——>[512,20,20] 压缩通道数
[-1, 1, Conv, [256, 1, 1]], #52 [512,20,20]——>[256,20,20] 压缩通道数
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #53 [256,20,20]——>[256,40,40] 二倍上采样,none类型,2倍上采样
[37, 1, Conv, [256, 1, 1]], # route backbone P4 54 [1024,40,40]——>[256,40,40] 37层横向连接
[[-1, -2], 1, Concat, [1]], #55 将54、53层concat,输出[512,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [256, 1, 1]], #56 [512,40,40]——>[256,40,40] 压缩通道数
[-2, 1, Conv, [256, 1, 1]], #57 [512,40,40]——>[256,40,40] 压缩通道数
[-1, 1, Conv, [128, 3, 1]], #58 [256,40,40]——>[128,40,40] 压缩通道数
[-1, 1, Conv, [128, 3, 1]], #59 [128,40,40]——>[128,40,40]
[-1, 1, Conv, [128, 3, 1]], #60 [128,40,40]——>[128,40,40]
[-1, 1, Conv, [128, 3, 1]], #61 [128,40,40]——>[128,40,40]
[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]], #62 将61、60、59、58、57、56层concat,输出[1024,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [256, 1, 1]], #63 [1024,40,40]——>[256,40,40] 压缩通道数
[-1, 1, Conv, [128, 1, 1]], #64 [256,40,40]——>[128,40,40] 压缩通道数
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #65 [128,40,40]——>[128,80,80]
[24, 1, Conv, [128, 1, 1]], # route backbone P3 66 [512,80,80]——>[128,80,80] 24层横向连接
[[-1, -2], 1, Concat, [1]], #67 将56、65层concat,输出[256,80,80] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [128, 1, 1]], #68 [256,80,80]——>[128,80,80] 压缩通道数
[-2, 1, Conv, [128, 1, 1]], #69 [256,80,80]——>[128,80,80] 压缩通道数
[-1, 1, Conv, [64, 3, 1]], #70 [128,80,80]——>[64,80,80] 压缩通道数
[-1, 1, Conv, [64, 3, 1]], #71 [64,80,80]——>[64,80,80]
[-1, 1, Conv, [64, 3, 1]], #72 [64,80,80]——>[64,80,80]
[-1, 1, Conv, [64, 3, 1]], #73 [64,80,80]——>[64,80,80]
[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]], #74 将73、72、71、70、69、68层concat,输出[512,80,80] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [128, 1, 1]], # 75 [512,80,80]——>[128,80,80] 压缩通道数
[-1, 1, MP, []], #76 [128,80,80]——>[128,40,40] 最大池化和卷积的并行结构,二倍下采样
[-1, 1, Conv, [128, 1, 1]], #77 [128,40,40]——>[128,40,40] 通道数不变
[-3, 1, Conv, [128, 1, 1]], #78 [128,80,80]——>[128,80,80] 通道数不变
[-1, 1, Conv, [128, 3, 2]], #79 [128,80,80]——>[128,40,40] 二倍下采样****
[[-1, -3, 63], 1, Concat, [1]], #80 将79、77、63层concat,输出[512,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [256, 1, 1]], #81 [512,40,40]——>[256,40,40] 压缩通道数
[-2, 1, Conv, [256, 1, 1]], #82 [512,40,40]——>[256,40,40] 压缩通道数
[-1, 1, Conv, [128, 3, 1]], #83 [256,40,40]——>[128,40,40] 压缩通道数
[-1, 1, Conv, [128, 3, 1]], #84 [128,40,40]——>[128,40,40]
[-1, 1, Conv, [128, 3, 1]], #85 [128,40,40]——>[128,40,40]
[-1, 1, Conv, [128, 3, 1]], #86 [128,40,40]——>[128,40,40]
[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]], #87 将86、85、84、83、82、81层concat,输出[1024,40,40] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [256, 1, 1]], # 88 [1024,40,40]——>[256,40,40]
[-1, 1, MP, []], #89 [256,40,40]——>[256,20,20] 最大池化和卷积的并行结构,
[-1, 1, Conv, [256, 1, 1]], #90 [256,20,20]——>[256,20,20] 通道数不变,
[-3, 1, Conv, [256, 1, 1]], #91 [256,40,40]——>[256,40,40] 通道数不变
[-1, 1, Conv, [256, 3, 2]], #92 [256,40,40]——>[256,20,20] 二倍下采样
[[-1, -3, 51], 1, Concat, [1]], #93 将92、90、51层concat,输出[1024,20,20] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [512, 1, 1]], #94 [1024,40,40]——>[512,20,20] 压缩通道数
[-2, 1, Conv, [512, 1, 1]], #95 [1024,40,40]——>[512,20,20] 压缩通道数
[-1, 1, Conv, [256, 3, 1]], #96 [512,20,20]——>[256,20,20] 压缩通道数
[-1, 1, Conv, [256, 3, 1]], #97 [256,20,20]——>[256,20,20]
[-1, 1, Conv, [256, 3, 1]], #98 [256,20,20]——>[256,20,20]
[-1, 1, Conv, [256, 3, 1]], #99 [256,20,20]——>[256,20,20]
[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]], #100 将99、98、97、96、95、94层concat,输出[2048,20,20] [B,C,H,W]在维度1通道上concat
[-1, 1, Conv, [512, 1, 1]], #101 [2048,20,20]——>[512,20,20] 压缩通道数
[75, 1, RepConv, [256, 3, 1]], #102 [128,80,80]——>[256,80,80] 升维
[88, 1, RepConv, [512, 3, 1]], #103 [256,40,40]——>[512,40,40] 升维
[101, 1, RepConv, [1024, 3, 1]], #104[512,20,20]——>[1024,20,20] 升维
[[102,103,104], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5) 105
]
如果你想要进一步了解更多的相关知识,可以关注下面公众号联系~会不定期发布相关设计内容包括但不限于如下内容:信号处理、通信仿真、算法设计、matlab appdesigner,gui设计、simulink仿真......希望能帮到你!
更多推荐
已为社区贡献22条内容
所有评论(0)