涵洞场景下的安全智能化巡检对于保障设施的正常运行有着重要的意义,在道路、公路、隧道、桥梁等场景下我们都已有实际的项目实践开发,而基于涵洞场景下的数据还未有过尝试,本文的核心目的就是想要构建基于涵洞场景下的智能化目标检测识别系统。
有别于前文系列主要以yolov5系列模型为基准选型,这里的模型主要以yolov7为基准选型,为了对比分析不同参数下模型的性能实效,这里我们分别选择了yolov7、yolov7x和yolov7e6e这三款模型来进行本文中系统模型的开发。
首先来看下效果图:
接下来看下本文选择使用的三款模型配置。
【yolov7】
# parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple
width_multiple: 1.0 # 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[-1, 1, Conv, [64, 3, 2]], # 1-P1/2 [-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [128, 3, 2]], # 3-P2/4 [-1, 1, Conv, [64, 1, 1]],[-2, 1, Conv, [64, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -3, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]], # 11[-1, 1, MP, []],[-1, 1, Conv, [128, 1, 1]],[-3, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 2]],[[-1, -3], 1, Concat, [1]], # 16-P3/8 [-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -3, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [512, 1, 1]], # 24[-1, 1, MP, []],[-1, 1, Conv, [256, 1, 1]],[-3, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 2]],[[-1, -3], 1, Concat, [1]], # 29-P4/16 [-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [1024, 1, 1]], # 37[-1, 1, MP, []],[-1, 1, Conv, [512, 1, 1]],[-3, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [512, 3, 2]],[[-1, -3], 1, Concat, [1]], # 42-P5/32 [-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [1024, 1, 1]], # 50]# yolov7 head
head:[[-1, 1, SPPCSPC, [512]], # 51[-1, 1, Conv, [256, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[37, 1, Conv, [256, 1, 1]], # route backbone P4[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]], # 63[-1, 1, Conv, [128, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[24, 1, Conv, [128, 1, 1]], # route backbone P3[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [128, 1, 1]], # 75[-1, 1, MP, []],[-1, 1, Conv, [128, 1, 1]],[-3, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 2]],[[-1, -3, 63], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]], # 88[-1, 1, MP, []],[-1, 1, Conv, [256, 1, 1]],[-3, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 2]],[[-1, -3, 51], 1, Concat, [1]],[-1, 1, Conv, [512, 1, 1]],[-2, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -2, -3, -4, -5, -6], 1, Concat, [1]],[-1, 1, Conv, [512, 1, 1]], # 101[75, 1, RepConv, [256, 3, 1]],[88, 1, RepConv, [512, 3, 1]],[101, 1, RepConv, [1024, 3, 1]],[[102,103,104], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)]
【yolov7x】
# parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple
width_multiple: 1.0 # 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, [40, 3, 1]], # 0[-1, 1, Conv, [80, 3, 2]], # 1-P1/2 [-1, 1, Conv, [80, 3, 1]],[-1, 1, Conv, [160, 3, 2]], # 3-P2/4 [-1, 1, Conv, [64, 1, 1]],[-2, 1, Conv, [64, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 13[-1, 1, MP, []],[-1, 1, Conv, [160, 1, 1]],[-3, 1, Conv, [160, 1, 1]],[-1, 1, Conv, [160, 3, 2]],[[-1, -3], 1, Concat, [1]], # 18-P3/8 [-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 28[-1, 1, MP, []],[-1, 1, Conv, [320, 1, 1]],[-3, 1, Conv, [320, 1, 1]],[-1, 1, Conv, [320, 3, 2]],[[-1, -3], 1, Concat, [1]], # 33-P4/16 [-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [1280, 1, 1]], # 43[-1, 1, MP, []],[-1, 1, Conv, [640, 1, 1]],[-3, 1, Conv, [640, 1, 1]],[-1, 1, Conv, [640, 3, 2]],[[-1, -3], 1, Concat, [1]], # 48-P5/32 [-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [1280, 1, 1]], # 58]# yolov7 head
head:[[-1, 1, SPPCSPC, [640]], # 59[-1, 1, Conv, [320, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[43, 1, Conv, [320, 1, 1]], # route backbone P4[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 73[-1, 1, Conv, [160, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[28, 1, Conv, [160, 1, 1]], # route backbone P3[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [160, 1, 1]], # 87[-1, 1, MP, []],[-1, 1, Conv, [160, 1, 1]],[-3, 1, Conv, [160, 1, 1]],[-1, 1, Conv, [160, 3, 2]],[[-1, -3, 73], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 102[-1, 1, MP, []],[-1, 1, Conv, [320, 1, 1]],[-3, 1, Conv, [320, 1, 1]],[-1, 1, Conv, [320, 3, 2]],[[-1, -3, 59], 1, Concat, [1]],[-1, 1, Conv, [512, 1, 1]],[-2, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 117[87, 1, Conv, [320, 3, 1]],[102, 1, Conv, [640, 3, 1]],[117, 1, Conv, [1280, 3, 1]],[[118,119,120], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)]
【yolov7e6e】
# parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple
width_multiple: 1.0 # layer channel multiple# anchors
anchors:- [ 19,27, 44,40, 38,94 ] # P3/8- [ 96,68, 86,152, 180,137 ] # P4/16- [ 140,301, 303,264, 238,542 ] # P5/32- [ 436,615, 739,380, 925,792 ] # P6/64# yolov7 backbone
backbone:# [from, number, module, args],[[-1, 1, ReOrg, []], # 0[-1, 1, Conv, [80, 3, 1]], # 1-P1/2[-1, 1, DownC, [160]], # 2-P2/4 [-1, 1, Conv, [64, 1, 1]],[-2, 1, Conv, [64, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [160, 1, 1]], # 12[-11, 1, Conv, [64, 1, 1]],[-12, 1, Conv, [64, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [160, 1, 1]], # 22[[-1, -11], 1, Shortcut, [1]], # 23[-1, 1, DownC, [320]], # 24-P3/8 [-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 34[-11, 1, Conv, [128, 1, 1]],[-12, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 44[[-1, -11], 1, Shortcut, [1]], # 45[-1, 1, DownC, [640]], # 46-P4/16 [-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 56[-11, 1, Conv, [256, 1, 1]],[-12, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 66[[-1, -11], 1, Shortcut, [1]], # 67[-1, 1, DownC, [960]], # 68-P5/32 [-1, 1, Conv, [384, 1, 1]],[-2, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [960, 1, 1]], # 78[-11, 1, Conv, [384, 1, 1]],[-12, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[-1, 1, Conv, [384, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [960, 1, 1]], # 88[[-1, -11], 1, Shortcut, [1]], # 89[-1, 1, DownC, [1280]], # 90-P6/64 [-1, 1, Conv, [512, 1, 1]],[-2, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [1280, 1, 1]], # 100 [-11, 1, Conv, [512, 1, 1]],[-12, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[-1, 1, Conv, [512, 3, 1]],[[-1, -3, -5, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [1280, 1, 1]], # 110[[-1, -11], 1, Shortcut, [1]], # 111 ]# yolov7 head
head:[[-1, 1, SPPCSPC, [640]], # 112[-1, 1, Conv, [480, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[89, 1, Conv, [480, 1, 1]], # route backbone P5[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [384, 1, 1]],[-2, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [480, 1, 1]], # 126[-11, 1, Conv, [384, 1, 1]],[-12, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [480, 1, 1]], # 136[[-1, -11], 1, Shortcut, [1]], # 137[-1, 1, Conv, [320, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[67, 1, Conv, [320, 1, 1]], # route backbone P4[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 151[-11, 1, Conv, [256, 1, 1]],[-12, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 161[[-1, -11], 1, Shortcut, [1]], # 162[-1, 1, Conv, [160, 1, 1]],[-1, 1, nn.Upsample, [None, 2, 'nearest']],[45, 1, Conv, [160, 1, 1]], # route backbone P3[[-1, -2], 1, Concat, [1]],[-1, 1, Conv, [128, 1, 1]],[-2, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [160, 1, 1]], # 176[-11, 1, Conv, [128, 1, 1]],[-12, 1, Conv, [128, 1, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[-1, 1, Conv, [64, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [160, 1, 1]], # 186[[-1, -11], 1, Shortcut, [1]], # 187[-1, 1, DownC, [320]],[[-1, 162], 1, Concat, [1]],[-1, 1, Conv, [256, 1, 1]],[-2, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 199[-11, 1, Conv, [256, 1, 1]],[-12, 1, Conv, [256, 1, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[-1, 1, Conv, [128, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [320, 1, 1]], # 209[[-1, -11], 1, Shortcut, [1]], # 210[-1, 1, DownC, [480]],[[-1, 137], 1, Concat, [1]],[-1, 1, Conv, [384, 1, 1]],[-2, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [480, 1, 1]], # 222[-11, 1, Conv, [384, 1, 1]],[-12, 1, Conv, [384, 1, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[-1, 1, Conv, [192, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [480, 1, 1]], # 232[[-1, -11], 1, Shortcut, [1]], # 233[-1, 1, DownC, [640]],[[-1, 112], 1, Concat, [1]],[-1, 1, Conv, [512, 1, 1]],[-2, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 245[-11, 1, Conv, [512, 1, 1]],[-12, 1, Conv, [512, 1, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[-1, 1, Conv, [256, 3, 1]],[[-1, -2, -3, -4, -5, -6, -7, -8], 1, Concat, [1]],[-1, 1, Conv, [640, 1, 1]], # 255[[-1, -11], 1, Shortcut, [1]], # 256[187, 1, Conv, [320, 3, 1]],[210, 1, Conv, [640, 3, 1]],[233, 1, Conv, [960, 3, 1]],[256, 1, Conv, [1280, 3, 1]],[186, 1, Conv, [320, 3, 1]],[161, 1, Conv, [640, 3, 1]],[136, 1, Conv, [960, 3, 1]],[112, 1, Conv, [1280, 3, 1]],[[257,258,259,260,261,262,263,264], 1, IAuxDetect, [nc, anchors]], # Detect(P3, P4, P5, P6)]
默认完全相同的参数进行训练,如下所示:
#yolov7
python train.py --cfg cfg/training/yolov7.yaml --weights weights/yolov7_training.pt --name yolov7 --epochs 100 --batch-size 32 --img 640 640 --device 0#yolov7x
python3 train.py --cfg cfg/training/yolov7x.yaml --weights weights/yolov7x_training.pt --name yolov7x --epochs 100 --batch-size 32 --img 640 640 --device 0#yolov7-e6e
python train_aux.py --cfg cfg/training/yolov7-e6e.yaml --weights weights/yolov7-e6e_training.pt --name yolov7e6e --epochs 100 --batch-size 32 --img 640 640 --device 0
接下来我们来直观对比分析下结果:
【Precision曲线】
精确率曲线(Precision-Recall Curve)是一种用于评估二分类模型在不同阈值下的精确率性能的可视化工具。它通过绘制不同阈值下的精确率和召回率之间的关系图来帮助我们了解模型在不同阈值下的表现。
精确率(Precision)是指被正确预测为正例的样本数占所有预测为正例的样本数的比例。召回率(Recall)是指被正确预测为正例的样本数占所有实际为正例的样本数的比例。
绘制精确率曲线的步骤如下:
使用不同的阈值将预测概率转换为二进制类别标签。通常,当预测概率大于阈值时,样本被分类为正例,否则分类为负例。
对于每个阈值,计算相应的精确率和召回率。
将每个阈值下的精确率和召回率绘制在同一个图表上,形成精确率曲线。
根据精确率曲线的形状和变化趋势,可以选择适当的阈值以达到所需的性能要求。
通过观察精确率曲线,我们可以根据需求确定最佳的阈值,以平衡精确率和召回率。较高的精确率意味着较少的误报,而较高的召回率则表示较少的漏报。根据具体的业务需求和成本权衡,可以在曲线上选择合适的操作点或阈值。
精确率曲线通常与召回率曲线(Recall Curve)一起使用,以提供更全面的分类器性能分析,并帮助评估和比较不同模型的性能。
【Recall曲线】
召回率曲线(Recall Curve)是一种用于评估二分类模型在不同阈值下的召回率性能的可视化工具。它通过绘制不同阈值下的召回率和对应的精确率之间的关系图来帮助我们了解模型在不同阈值下的表现。
召回率(Recall)是指被正确预测为正例的样本数占所有实际为正例的样本数的比例。召回率也被称为灵敏度(Sensitivity)或真正例率(True Positive Rate)。
绘制召回率曲线的步骤如下:
使用不同的阈值将预测概率转换为二进制类别标签。通常,当预测概率大于阈值时,样本被分类为正例,否则分类为负例。
对于每个阈值,计算相应的召回率和对应的精确率。
将每个阈值下的召回率和精确率绘制在同一个图表上,形成召回率曲线。
根据召回率曲线的形状和变化趋势,可以选择适当的阈值以达到所需的性能要求。
通过观察召回率曲线,我们可以根据需求确定最佳的阈值,以平衡召回率和精确率。较高的召回率表示较少的漏报,而较高的精确率意味着较少的误报。根据具体的业务需求和成本权衡,可以在曲线上选择合适的操作点或阈值。
召回率曲线通常与精确率曲线(Precision Curve)一起使用,以提供更全面的分类器性能分析,并帮助评估和比较不同模型的性能。。
【F1值曲线】
F1值曲线是一种用于评估二分类模型在不同阈值下的性能的可视化工具。它通过绘制不同阈值下的精确率(Precision)、召回率(Recall)和F1分数的关系图来帮助我们理解模型的整体性能。
F1分数是精确率和召回率的调和平均值,它综合考虑了两者的性能指标。F1值曲线可以帮助我们确定在不同精确率和召回率之间找到一个平衡点,以选择最佳的阈值。
绘制F1值曲线的步骤如下:
使用不同的阈值将预测概率转换为二进制类别标签。通常,当预测概率大于阈值时,样本被分类为正例,否则分类为负例。
对于每个阈值,计算相应的精确率、召回率和F1分数。
将每个阈值下的精确率、召回率和F1分数绘制在同一个图表上,形成F1值曲线。
根据F1值曲线的形状和变化趋势,可以选择适当的阈值以达到所需的性能要求。
F1值曲线通常与接收者操作特征曲线(ROC曲线)一起使用,以帮助评估和比较不同模型的性能。它们提供了更全面的分类器性能分析,可以根据具体应用场景来选择合适的模型和阈值设置。
也可能是没有调参的缘故,整体实验结果发现yolov7模型的效果反而是最优的,针对模型训练时耗来说,yolov7的训练时间消耗也是相对最少的。在实际项目开发过程中还是需要根据自己的数据场景选择真正合适的模型才是最优的方式。