【YOLOv10多模态融合改进】在前期、中期、中后期、后期多模态融合中添加P6大目标检测层,完整步骤及代码
前言
主题: YOLOv10 的多模态融合改进中增加P6大目标检测层
方式: 分别在前期融合、中期融合、中-后期融合、后期融合中增加P6多模态融合检测层。
内容: 包含融合方式详解以及完整配置步骤,开箱即用,一键运行。
一、YOLOv10原始模型结构介绍
YOLOv10
原始模型结构如下:
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
backbone:
# [from, repeats, module, args]
- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 9
- [-1, 1, PSA, [1024]] # 10
# YOLOv10.0n head
head:
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 6], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [512]] # 13
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 4], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 16 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 13], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 19 (P4/16-medium)
- [-1, 1, SCDown, [512, 3, 2]]
- [[-1, 10], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 22 (P5/32-large)
- [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5)
二、有效特征层对应的检测头类别
2.1 P3/8 - small检测头
-
原始模型中的
P3/8特征层对应的检测头主要用于检测相对较小的目标。其特征图大小相对较大,空间分辨率较高。 -
适合检测尺寸大概在
8x8到16x16像素左右的目标。
2.2 P4/16 - medium检测头
-
这个检测头对应的
P4/16特征层经过了更多的下采样操作,相比P3/8特征图空间分辨率降低,但通道数增加,特征更抽象且有语义信息。 -
它主要用于检测中等大小的目标,尺寸范围大概在
16x16到32x32像素左右。
2.3 P5/32 - large检测头
-
P5/32是经过最多下采样操作得到的特征层,其空间分辨率最低,但语义信息最强、全局感受野最大。 -
该检测头适合检测较大尺寸的目标,一般是尺寸在
32x32像素以上的目标。
2.4 新添加针对大目标的检测头
-
新添加的检测头主要用于检测更大尺寸的目标。尺寸在
64x64像素以上的超大目标。
💡这是因为在目标检测任务中,随着目标尺寸的增大,需要更能关注到整体轮廓的特征图来有效捕捉大目标特征。
三、P6检测层的多模态融合方式
-
前期融合中,在网络输入阶段将多模态数据合并后,增加针对大目标的检测层。
-
中期融合中,在骨干网络中增加针对P6的多模态特征进行融合,以此引出大目标的检测层。
-
中-后期融合中,在颈部的FPN结构中,增加针对P6的多模态特征进行融合,以此引出大目标的检测层。
-
后期融合中,在检测头前增加P6多模态特征进行融合。
四、完整配置步骤
!!! 私信获取的项目包就已经把相关的多模态输入、训练等改动都已经配好了,只需要新建模型yaml文件,粘贴对应的模型,进行训练即可。 项目包获取及使用教程可参考链接: 《YOLO系列模型的多模态项目》配置使用教程
在什么地方新建,n,s,m,l,x,用哪个版本按自己的需求来即可,和普通的训练步骤一致。
除了模型结构方面的改动,在yaml文件中还传入了一个通道数
ch: 6
表示传入的是双模态,6通道 ,前三个是可见光,后三个是红外。
在default.yaml中也配置了这个参数。
4.1 P6前期融合
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
ch: 6
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
backbone:
# [from, repeats, module, args]
- [-1, 1, MF, [64]] # 0
- [-1, 1, Conv, [64, 3, 2]] # 1-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 2-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 4-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 6-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 8-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 10-P6/64
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 12
- [-1, 1, PSA, [1024]] # 13
# YOLOv10.0n head
head:
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 9], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 16
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 7], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 19 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 5], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 22 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 19], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 25 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]]
- [[-1, 16], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [768]] # 28 (P4/16-medium)
- [-1, 1, SCDown, [768, 3, 2]]
- [[-1, 13], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 31 (P5/32-large)
- [[22, 25, 28, 31], 1, v10Detect, [nc]] # Detect(P3, P4, P5)
4.2 P6中期融合
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
ch: 6
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
backbone:
# [from, repeats, module, args]
- [-1, 1, IN, []] # 0
- [-1, 1, Multiin, [1]] # 1
- [-2, 1, Multiin, [2]] # 2
- [1, 1, Conv, [64, 3, 2]] # 3-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 4-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 6-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 8-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 10-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 12-P6/64
- [-1, 3, C2f, [1024, True]]
- [2, 1, Conv, [64, 3, 2]] # 14-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 15-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 17-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 19-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 21-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 23-P6/64
- [-1, 3, C2f, [1024, True]]
- [[7, 18], 1, Concat, [1]] # 25 cat backbone P2
- [[9, 20], 1, Concat, [1]] # 26 cat backbone P3
- [[11, 22], 1, Concat, [1]] # 27 cat backbone P4
- [[13, 24], 1, Concat, [1]] # 28 cat backbone P5
- [-1, 1, SPPF, [1024, 5]] # 29
- [-1, 1, PSA, [1024]] # 30
# YOLOv10.0n head
head:
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 27], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 33
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 26], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 36 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 25], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 39 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 36], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 42 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]]
- [[-1, 33], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [768]] # 45 (P4/16-medium)
- [-1, 1, SCDown, [768, 3, 2]]
- [[-1, 30], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 48 (P5/32-large)
- [[39, 42, 45, 48], 1, v10Detect, [nc]] # Detect(P3, P4, P5)
4.3 P6中-后期融合
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
ch: 6
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
backbone:
# [from, repeats, module, args]
- [-1, 1, IN, []] # 0
- [-1, 1, Multiin, [1]] # 1
- [-2, 1, Multiin, [2]] # 2
- [1, 1, Conv, [64, 3, 2]] # 3-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 4-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 6-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 8-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 10-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 12-P6/64
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 14
- [-1, 1, PSA, [1024]] # 15
- [2, 1, Conv, [64, 3, 2]] # 16-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 17-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 19-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 21-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 23-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 25-P6/64
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 27
- [-1, 1, PSA, [1024]] # 28
# YOLOv10.0n head
head:
- [15, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 11], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 31
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 9], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 34 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 7], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 37 (P3/8-small)
- [28, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 24], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 40
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 22], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 43 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 20], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 46 (P3/8-small)
- [[15, 28], 1, Concat, [1]] # 47 cat backbone P2
- [[31, 40], 1, Concat, [1]] # 48 cat backbone P3
- [[34, 43], 1, Concat, [1]] # 49 cat backbone P4
- [[37, 46], 1, Concat, [1]] # 50 cat backbone P5
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 49], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 53 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]]
- [[-1, 48], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [768]] # 56 (P4/16-medium)
- [-1, 1, SCDown, [768, 3, 2]]
- [[-1, 47], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 59 (P5/32-large)
- [[50, 53, 56, 59], 1, v10Detect, [nc]] # Detect(P3, P4, P5)
4.4 P6后期融合
# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
ch: 6
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024]
backbone:
# [from, repeats, module, args]
- [-1, 1, IN, []] # 0
- [-1, 1, Multiin, [1]] # 1
- [-2, 1, Multiin, [2]] # 2
- [1, 1, Conv, [64, 3, 2]] # 3-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 4-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 6-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 8-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 10-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 12-P6/64
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 14
- [-1, 1, PSA, [1024]] # 15
- [2, 1, Conv, [64, 3, 2]] # 16-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 17-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 19-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, SCDown, [512, 3, 2]] # 21-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, SCDown, [768, 3, 2]] # 23-P5/32
- [-1, 3, C2f, [768, True]]
- [-1, 1, SCDown, [1024, 3, 2]] # 25-P6/64
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 27
- [-1, 1, PSA, [1024]] # 28
# YOLOv10.0n head
head:
- [15, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 11], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 31
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 9], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 34 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 7], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 37 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 34], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 40 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]]
- [[-1, 31], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [768]] # 43 (P4/16-medium)
- [-1, 1, SCDown, [768, 3, 2]]
- [[-1, 15], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 46 (P5/32-large)
- [28, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 24], 1, Concat, [1]] # cat backbone P4
- [-1, 3, C2f, [768]] # 49
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 22], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [512]] # 52 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, "nearest"]]
- [[-1, 20], 1, Concat, [1]] # cat backbone P3
- [-1, 3, C2f, [256]] # 55 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]]
- [[-1, 52], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [512]] # 58 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]]
- [[-1, 49], 1, Concat, [1]] # cat head P4
- [-1, 3, C2f, [768]] # 61 (P4/16-medium)
- [-1, 1, SCDown, [768, 3, 2]]
- [[-1, 28], 1, Concat, [1]] # cat head P5
- [-1, 3, C2fCIB, [1024, True, True]] # 64 (P5/32-large)
- [[37, 55], 1, Concat, [1]] # 65 cat backbone P3
- [[40, 58], 1, Concat, [1]] # 66 cat backbone P4
- [[43, 61], 1, Concat, [1]] # 67 cat backbone P5
- [[46, 64], 1, Concat, [1]] # 68 cat backbone P6
- [[65, 66, 67, 68], 1, v10Detect, [nc]] # Detect(P3, P4, P5)
五、成功运行结果
前期融合结果: 可以看到输入的通道数为6,表明可见光图像和红外图像均输入到了模型中进行融合训练。
YOLOv10n-early-p6 summary: 505 layers, 4,124,560 parameters, 4,124,544 gradients, 9.2 GFLOPs
from n params module arguments
0 -1 1 472 ultralytics.nn.AddModules.multimodal.MF [6, 16]
1 -1 1 2336 ultralytics.nn.modules.conv.Conv [16, 16, 3, 2]
2 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
3 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
4 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
5 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
6 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
7 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
8 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
9 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
10 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
11 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
12 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
13 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
14 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
15 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
16 -1 1 308352 ultralytics.nn.modules.block.C2f [448, 192, 1]
17 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
18 [-1, 7] 1 0 ultralytics.nn.modules.conv.Concat [1]
19 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
20 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
21 [-1, 5] 1 0 ultralytics.nn.modules.conv.Concat [1]
22 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
23 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
24 [-1, 19] 1 0 ultralytics.nn.modules.conv.Concat [1]
25 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
26 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
27 [-1, 16] 1 0 ultralytics.nn.modules.conv.Concat [1]
28 -1 1 283776 ultralytics.nn.modules.block.C2f [320, 192, 1]
29 -1 1 39360 ultralytics.nn.modules.block.SCDown [192, 192, 3, 2]
30 [-1, 13] 1 0 ultralytics.nn.modules.conv.Concat [1]
31 -1 1 299008 ultralytics.nn.modules.block.C2fCIB [448, 256, 1, True, True]
32 [22, 25, 28, 31] 1 1204504 ultralytics.nn.modules.head.v10Detect [1, [64, 128, 192, 256]]
YOLOv10n-early-p6 summary: 505 layers, 4,124,560 parameters, 4,124,544 gradients, 9.2 GFLOPs
中期融合结果:
YOLOv10n-mid-p6 summary: 621 layers, 5,496,440 parameters, 5,496,424 gradients, 11.4 GFLOPs
from n params module arguments
0 -1 1 0 ultralytics.nn.AddModules.multimodal.IN []
1 -1 1 0 ultralytics.nn.AddModules.multimodal.Multiin [1]
2 -2 1 0 ultralytics.nn.AddModules.multimodal.Multiin [2]
3 1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
4 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
5 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
6 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
7 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
8 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
9 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
10 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
11 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
12 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
13 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
14 2 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
15 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
16 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
17 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
18 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
19 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
20 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
21 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
22 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
23 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
24 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
25 [7, 18] 1 0 ultralytics.nn.modules.conv.Concat [1]
26 [9, 20] 1 0 ultralytics.nn.modules.conv.Concat [1]
27 [11, 22] 1 0 ultralytics.nn.modules.conv.Concat [1]
28 [13, 24] 1 0 ultralytics.nn.modules.conv.Concat [1]
29 -1 1 394240 ultralytics.nn.modules.block.SPPF [512, 256, 5]
30 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
31 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
32 [-1, 27] 1 0 ultralytics.nn.modules.conv.Concat [1]
33 -1 1 345216 ultralytics.nn.modules.block.C2f [640, 192, 1]
34 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
35 [-1, 26] 1 0 ultralytics.nn.modules.conv.Concat [1]
36 -1 1 156416 ultralytics.nn.modules.block.C2f [448, 128, 1]
37 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
38 [-1, 25] 1 0 ultralytics.nn.modules.conv.Concat [1]
39 -1 1 41344 ultralytics.nn.modules.block.C2f [256, 64, 1]
40 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
41 [-1, 36] 1 0 ultralytics.nn.modules.conv.Concat [1]
42 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
43 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
44 [-1, 33] 1 0 ultralytics.nn.modules.conv.Concat [1]
45 -1 1 283776 ultralytics.nn.modules.block.C2f [320, 192, 1]
46 -1 1 39360 ultralytics.nn.modules.block.SCDown [192, 192, 3, 2]
47 [-1, 30] 1 0 ultralytics.nn.modules.conv.Concat [1]
48 -1 1 299008 ultralytics.nn.modules.block.C2fCIB [448, 256, 1, True, True]
49 [39, 42, 45, 48] 1 1204504 ultralytics.nn.modules.head.v10Detect [1, [64, 128, 192, 256]]
YOLOv10n-mid-p6 summary: 621 layers, 5,496,440 parameters, 5,496,424 gradients, 11.4 GFLOPs
中-后期融合结果:
YOLOv10n-mid-to-late-p6 summary: 708 layers, 6,545,016 parameters, 6,545,000 gradients, 14.6 GFLOPs
from n params module arguments
0 -1 1 0 ultralytics.nn.AddModules.multimodal.IN []
1 -1 1 0 ultralytics.nn.AddModules.multimodal.Multiin [1]
2 -2 1 0 ultralytics.nn.AddModules.multimodal.Multiin [2]
3 1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
4 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
5 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
6 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
7 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
8 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
9 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
10 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
11 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
12 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
13 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
14 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
15 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
16 2 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
17 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
18 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
19 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
20 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
21 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
22 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
23 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
24 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
25 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
26 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
27 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
28 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
29 15 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
30 [-1, 11] 1 0 ultralytics.nn.modules.conv.Concat [1]
31 -1 1 308352 ultralytics.nn.modules.block.C2f [448, 192, 1]
32 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
33 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
34 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
35 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
36 [-1, 7] 1 0 ultralytics.nn.modules.conv.Concat [1]
37 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
38 28 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
39 [-1, 24] 1 0 ultralytics.nn.modules.conv.Concat [1]
40 -1 1 308352 ultralytics.nn.modules.block.C2f [448, 192, 1]
41 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
42 [-1, 22] 1 0 ultralytics.nn.modules.conv.Concat [1]
43 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
44 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
45 [-1, 20] 1 0 ultralytics.nn.modules.conv.Concat [1]
46 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
47 [15, 28] 1 0 ultralytics.nn.modules.conv.Concat [1]
48 [31, 40] 1 0 ultralytics.nn.modules.conv.Concat [1]
49 [34, 43] 1 0 ultralytics.nn.modules.conv.Concat [1]
50 [37, 46] 1 0 ultralytics.nn.modules.conv.Concat [1]
51 -1 1 73856 ultralytics.nn.modules.conv.Conv [128, 64, 3, 2]
52 [-1, 49] 1 0 ultralytics.nn.modules.conv.Concat [1]
53 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
54 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
55 [-1, 48] 1 0 ultralytics.nn.modules.conv.Concat [1]
56 -1 1 320640 ultralytics.nn.modules.block.C2f [512, 192, 1]
57 -1 1 39360 ultralytics.nn.modules.block.SCDown [192, 192, 3, 2]
58 [-1, 47] 1 0 ultralytics.nn.modules.conv.Concat [1]
59 -1 1 364544 ultralytics.nn.modules.block.C2fCIB [704, 256, 1, True, True]
60 [50, 53, 56, 59] 1 1484440 ultralytics.nn.modules.head.v10Detect [1, [128, 128, 192, 256]]
YOLOv10n-mid-to-late-p6 summary: 708 layers, 6,545,016 parameters, 6,545,000 gradients, 14.6 GFLOPs
后期融合结果:
YOLOv10n-late-p6 summary: 787 layers, 8,143,544 parameters, 8,143,528 gradients, 16.2 GFLOPs
from n params module arguments
0 -1 1 0 ultralytics.nn.AddModules.multimodal.IN []
1 -1 1 0 ultralytics.nn.AddModules.multimodal.Multiin [1]
2 -2 1 0 ultralytics.nn.AddModules.multimodal.Multiin [2]
3 1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
4 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
5 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
6 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
7 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
8 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
9 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
10 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
11 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
12 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
13 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
14 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
15 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
16 2 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
17 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
18 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
19 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
20 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
21 -1 1 9856 ultralytics.nn.modules.block.SCDown [64, 128, 3, 2]
22 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
23 -1 1 27072 ultralytics.nn.modules.block.SCDown [128, 192, 3, 2]
24 -1 1 259200 ultralytics.nn.modules.block.C2f [192, 192, 1, True]
25 -1 1 52480 ultralytics.nn.modules.block.SCDown [192, 256, 3, 2]
26 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
27 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
28 -1 1 249728 ultralytics.nn.modules.block.PSA [256, 256]
29 15 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
30 [-1, 11] 1 0 ultralytics.nn.modules.conv.Concat [1]
31 -1 1 308352 ultralytics.nn.modules.block.C2f [448, 192, 1]
32 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
33 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
34 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
35 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
36 [-1, 7] 1 0 ultralytics.nn.modules.conv.Concat [1]
37 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
38 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
39 [-1, 34] 1 0 ultralytics.nn.modules.conv.Concat [1]
40 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
41 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
42 [-1, 31] 1 0 ultralytics.nn.modules.conv.Concat [1]
43 -1 1 283776 ultralytics.nn.modules.block.C2f [320, 192, 1]
44 -1 1 39360 ultralytics.nn.modules.block.SCDown [192, 192, 3, 2]
45 [-1, 15] 1 0 ultralytics.nn.modules.conv.Concat [1]
46 -1 1 299008 ultralytics.nn.modules.block.C2fCIB [448, 256, 1, True, True]
47 28 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
48 [-1, 24] 1 0 ultralytics.nn.modules.conv.Concat [1]
49 -1 1 308352 ultralytics.nn.modules.block.C2f [448, 192, 1]
50 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
51 [-1, 22] 1 0 ultralytics.nn.modules.conv.Concat [1]
52 -1 1 140032 ultralytics.nn.modules.block.C2f [320, 128, 1]
53 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
54 [-1, 20] 1 0 ultralytics.nn.modules.conv.Concat [1]
55 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
56 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
57 [-1, 52] 1 0 ultralytics.nn.modules.conv.Concat [1]
58 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
59 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
60 [-1, 49] 1 0 ultralytics.nn.modules.conv.Concat [1]
61 -1 1 283776 ultralytics.nn.modules.block.C2f [320, 192, 1]
62 -1 1 39360 ultralytics.nn.modules.block.SCDown [192, 192, 3, 2]
63 [-1, 28] 1 0 ultralytics.nn.modules.conv.Concat [1]
64 -1 1 299008 ultralytics.nn.modules.block.C2fCIB [448, 256, 1, True, True]
65 [37, 55] 1 0 ultralytics.nn.modules.conv.Concat [1]
66 [40, 58] 1 0 ultralytics.nn.modules.conv.Concat [1]
67 [43, 61] 1 0 ultralytics.nn.modules.conv.Concat [1]
68 [46, 64] 1 0 ultralytics.nn.modules.conv.Concat [1]
69 [65, 66, 67, 68] 1 2308120 ultralytics.nn.modules.head.v10Detect [1, [128, 256, 384, 512]]
YOLOv10n-late-p6 summary: 787 layers, 8,143,544 parameters, 8,143,528 gradients, 16.2 GFLOPs