💡💡💡本文解决的问题点:创新点为什么在自己数据集不涨点,甚至出现降点的现象???

💡💡💡原因分析:不同数据集加入创新点存在表现不一致是正常现象,甚至放在网络不同位置也存在有的位置能够涨点,有的位置降点现象!!!

💡💡💡如何解决: 将创新点放入不同网络位置并提供对应的yaml文件,总有一种能够在你数据集下高效涨点。所以还是要多做实验,做各种尝试,可能就能取得意外的涨点现象!!!

💡💡💡涨点情况:原始mAP50为0.768,改进1结构图为mAP50为0.788,改进2结构图为mAP50为0.792改进3结构图为mAP50为 0.775

改进1结构图:

改进2结构图:

改进3结构图:

   

 《YOLOv11魔术师专栏》将从以下各个方向进行创新:

链接:

YOLO11魔术师

原创自研模块】【多组合点优化】【注意力机制】【卷积魔改】【block&多尺度融合结合】【损失&IOU优化】【上下采样优化 【小目标性能提升】前沿论文分享】【训练实战篇】

订阅者通过添加WX: AI_CV_0624,入群沟通,提供改进结构图等一系列定制化服务。

定期向订阅者提供源码工程,配合博客使用。

订阅者可以申请发票,便于报销 

💡💡💡为本专栏订阅者提供创新点改进代码,改进网络结构图,方便paper写作!!!

💡💡💡适用场景:红外、小目标检测、工业缺陷检测、医学影像、遥感目标检测、低对比度场景

💡💡💡适用任务:所有改进点适用【检测】、【分割】、【pose】、【分类】等

💡💡💡全网独家首发创新,【自研多个自研模块】,【多创新点组合适合paper 】!!!

☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️ ☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️

包含注意力机制魔改、卷积魔改、检测头创新、损失&IOU优化、block优化&多层特征融合、 轻量级网络设计、24年最新顶会改进思路、原创自研paper级创新等

🚀🚀🚀 本项目持续更新 | 更新完结保底≥80+ ,冲刺100+ 🚀🚀🚀

🍉🍉🍉 联系WX: AI_CV_0624 欢迎交流!🍉🍉🍉

⭐⭐⭐专栏涨价趋势 159 ->199->259->299,越早订阅越划算⭐⭐⭐

💡💡💡 2024年计算机视觉顶会创新点适用于Yolov5、Yolov7、Yolov8、Yolov9等各个Yolo系列,专栏文章提供每一步步骤和源码,轻松带你上手魔改网络 !!!

💡💡💡重点:通过本专栏的阅读,后续你也可以设计魔改网络,在网络不同位置(Backbone、head、detect、loss等)进行魔改,实现创新!!!

☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️ ☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️

1.YOLO11介绍

Ultralytics YOLO11是一款尖端的、最先进的模型,它在之前YOLO版本成功的基础上进行了构建,并引入了新功能和改进,以进一步提升性能和灵活性。YOLO11设计快速、准确且易于使用,使其成为各种物体检测和跟踪、实例分割、图像分类以及姿态估计任务的绝佳选择。

结构图如下:

1.1 C3k2

C3k2,结构图如下

C3k2,继承自类C2f,其中通过c3k设置False或者Ture来决定选择使用C3k还是Bottleneck

实现代码ultralytics/nn/modules/block.py

1.2 C2PSA介绍

借鉴V10 PSA结构,实现了C2PSA和C2fPSA,最终选择了基于C2的C2PSA(可能涨点更好?)

实现代码ultralytics/nn/modules/block.py

1.3 11 Detect介绍

分类检测头引入了DWConv(更加轻量级,为后续二次创新提供了改进点),结构图如下(和V8的区别):

实现代码ultralytics/nn/modules/head.py 

2.如何训练NEU-DET数据集

2.1.1 数据集介绍

直接搬运v8的就能使用

2.1.2 超参数修改

位置如下default.yaml

2.2.3 如何训练

import warnings
warnings.filterwarnings('ignore')
from ultralytics import YOLO

if __name__ == '__main__':
    model = YOLO('ultralytics/cfg/models/11/yolo11-EMA_attention.yaml')
    #model.load('yolov8n.pt') # loading pretrain weights
    model.train(data='data/NEU-DET.yaml',
                cache=False,
                imgsz=640,
                epochs=200,
                batch=8,
                close_mosaic=10,
                device='0',
                optimizer='SGD', # using SGD
                project='runs/train',
                name='exp',
                )

2.2.4训练结果可视化结果

YOLO11n summary (fused): 238 layers, 2,583,322 parameters, 0 gradients, 6.3 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 21/21 [00:07<00:00,  2.93it/s]
                   all        324        747      0.765      0.679      0.768      0.433
               crazing         47        104      0.678      0.337      0.508       0.22
             inclusion         71        190      0.775      0.705       0.79      0.398
               patches         59        149      0.808      0.859      0.927      0.636
        pitted_surface         61         93       0.81      0.667      0.779      0.483
       rolled-in_scale         56        117      0.684      0.593       0.67      0.317
             scratches         54         94      0.833      0.915      0.934      0.544

3.MSCAAttention介绍

论文:https://arxiv.org/pdf/2209.08575.pdf

摘要:介绍了一种用于语义分割的简单卷积网络体系结构SegNeXt。由于在编码空间信息时自我注意的效率,最近基于Transformer的模型已主导语义分割领域。在本文中,我们证明了卷积注意比Transformer中的自注意机制更有效地编码上下文信息。本文对已有成功分割方案进行了重审视并发现了几个有助于性能提升的关键成分,进而促使我们设计了一种新型的卷积注意力架构方案SegNeXt。在没有任何花哨的成分下,我们的SegNeXt显着改善了以前在流行基准测试 (包括ADE20K,Cityscapes,COCO-Stuff,Pascal VOC,Pascal Context和iSAID) 上最先进的方法的性能。值得注意的是,SegNeXt的性能优于EfficientNet-L2 w/ NAS-FPN,并且仅使用其1/10参数在Pascal VOC 2012测试一下排行榜上实现90.6% mIoU。与ad20k数据集上具有相同或更少计算的最新方法相比,SegNeXt平均实现了约2.0% mIoU改进。
 

设计了一种新的多尺度卷积注意(MSCA)模块。如图2 (a)所示,MSCA包含三个部分:深度卷积聚合局部信息,多分支深度条卷积捕获多尺度上下文,以及1×1卷积建模不同通道之间的关系。

 4.MSCAAttention如何加入到YOLO11

源码链接:

YOLO11涨点优化:注意力魔改 | 新颖的多尺度卷积注意力(MSCA),即插即用,助力小目标检测-CSDN博客

4.1 yaml修改

提供多种 MSCAAttention修改方式,分别加在网络不同位置,总有一种适合你的数据集

4.1.1 yolo11-MSCAAttention.yaml

# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect

# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'
  # [depth, width, max_channels]
  n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPs
  s: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPs
  m: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPs
  l: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPs
  x: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs

# YOLO11n backbone
backbone:
  # [from, repeats, module, args]
  - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
  - [-1, 2, C3k2, [256, False, 0.25]]
  - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
  - [-1, 2, C3k2, [512, False, 0.25]]
  - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
  - [-1, 2, C3k2, [512, True]]
  - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32
  - [-1, 2, C3k2, [1024, True]]
  - [-1, 1, SPPF, [1024, 5]] # 9
  - [-1, 2, C2PSA, [1024]] # 10
  - [-1, 1, MSCAAttention, []] # 11

# YOLO11n head
head:
  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 6], 1, Concat, [1]] # cat backbone P4
  - [-1, 2, C3k2, [512, False]] # 14

  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 4], 1, Concat, [1]] # cat backbone P3
  - [-1, 2, C3k2, [256, False]] # 17 (P3/8-small)

  - [-1, 1, Conv, [256, 3, 2]]
  - [[-1, 14], 1, Concat, [1]] # cat head P4
  - [-1, 2, C3k2, [512, False]] # 20 (P4/16-medium)

  - [-1, 1, Conv, [512, 3, 2]]
  - [[-1, 11], 1, Concat, [1]] # cat head P5
  - [-1, 2, C3k2, [1024, True]] # 23 (P5/32-large)

  - [[17, 20, 23], 1, Detect, [nc]] # Detect(P3, P4, P5)

 实验结果如下:

原始mAP50为0.768,改进1结构图为mAP50为0.788

YOLO11-MSCAAttention summary (fused): 247 layers, 2,677,274 parameters, 0 gradients, 6.4 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 21/21 [00:14<00:00,  1.46it/s]
                   all        324        747      0.735      0.721      0.788      0.439
               crazing         47        104      0.667      0.404       0.57      0.238
             inclusion         71        190      0.702      0.719      0.796      0.408
               patches         59        149      0.851      0.946      0.955      0.638
        pitted_surface         61         93      0.768       0.72      0.787      0.486
       rolled-in_scale         56        117      0.659      0.644      0.714      0.321
             scratches         54         94      0.762      0.894      0.908      0.542

 4.1.2 yolo11-MSCAAttention1.yaml

# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect

# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'
  # [depth, width, max_channels]
  n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPs
  s: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPs
  m: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPs
  l: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPs
  x: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs

# YOLO11n backbone
backbone:
  # [from, repeats, module, args]
  - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
  - [-1, 2, C3k2, [256, False, 0.25]]
  - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
  - [-1, 2, C3k2, [512, False, 0.25]]
  - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
  - [-1, 2, C3k2, [512, True]]
  - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32
  - [-1, 2, C3k2, [1024, True]]
  - [-1, 1, SPPF, [1024, 5]] # 9
  - [-1, 2, C2PSA, [1024]] # 10

# YOLO11n head
head:
  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 6], 1, Concat, [1]] # cat backbone P4
  - [-1, 2, C3k2, [512, False]] # 13

  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 4], 1, Concat, [1]] # cat backbone P3
  - [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)

  - [-1, 1, Conv, [256, 3, 2]]
  - [[-1, 13], 1, Concat, [1]] # cat head P4
  - [-1, 2, C3k2, [512, False]] # 19 (P4/16-medium)

  - [-1, 1, Conv, [512, 3, 2]]
  - [[-1, 10], 1, Concat, [1]] # cat head P5
  - [-1, 2, C3k2, [1024, True]] # 22 (P5/32-large)
  
  - [16, 1, MSCAAttention, []] # 23
  - [19, 1, MSCAAttention, []] # 24
  - [22, 1, MSCAAttention, []] # 25

  - [[23, 24, 25], 1, Detect, [nc]] # Detect(P3, P4, P5)

 实验结果如下:

原始mAP50为0.768,改进2结构图为mAP50为0.792

YOLO11-MSCAAttention1 summary (fused): 265 layers, 2,719,066 parameters, 0 gradients, 6.6 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 21/21 [00:10<00:00,  1.93it/s]
                   all        324        747      0.746      0.713      0.792      0.436
               crazing         47        104      0.627       0.42      0.521      0.219
             inclusion         71        190      0.776      0.747      0.834       0.43
               patches         59        149      0.811      0.919      0.934      0.637
        pitted_surface         61         93      0.766      0.688      0.787      0.472
       rolled-in_scale         56        117      0.808       0.65      0.767       0.36
             scratches         54         94      0.692      0.851      0.906        0.5

 4.1.3 yolo11-MSCAAttention2.yaml

# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect

# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'
  # [depth, width, max_channels]
  n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPs
  s: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPs
  m: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPs
  l: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPs
  x: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs

# YOLO11n backbone
backbone:
  # [from, repeats, module, args]
  - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
  - [-1, 2, C3k2, [256, False, 0.25]]
  - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
  - [-1, 2, C3k2, [512, False, 0.25]]
  - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
  - [-1, 2, C3k2, [512, True]]
  - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32
  - [-1, 2, C3k2, [1024, True]]
  - [-1, 1, SPPF, [1024, 5]] # 9
  - [-1, 2, C2PSA, [1024]] # 10

# YOLO11n head
head:
  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 6], 1, Concat, [1]] # cat backbone P4
  - [-1, 2, C3k2, [512, False]] # 13

  - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  - [[-1, 4], 1, Concat, [1]] # cat backbone P3
  - [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)
  - [-1, 1, MSCAAttention, []] # 17

  - [-1, 1, Conv, [256, 3, 2]]
  - [[-1, 13], 1, Concat, [1]] # cat head P4
  - [-1, 2, C3k2, [512, False]] # 20 (P4/16-medium)
  - [-1, 1, MSCAAttention, []] # 21

  - [-1, 1, Conv, [512, 3, 2]]
  - [[-1, 10], 1, Concat, [1]] # cat head P5
  - [-1, 2, C3k2, [1024, True]] # 24 (P5/32-large)
  - [-1, 1, MSCAAttention, []] # 25

  - [[17, 21, 25], 1, Detect, [nc]] # Detect(P3, P4, P5)

 实验结果如下:

原始mAP50为0.768,改进3结构图为mAP50为0.775

YOLO11-MSCAAttention2 summary (fused): 265 layers, 2,719,066 parameters, 0 gradients, 6.6 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 21/21 [00:10<00:00,  1.98it/s]
                   all        324        747       0.72      0.717      0.775      0.413
               crazing         47        104      0.632      0.404      0.533      0.239
             inclusion         71        190      0.758      0.758       0.81       0.42
               patches         59        149      0.792      0.926      0.944      0.636
        pitted_surface         61         93       0.78       0.71      0.786      0.496
       rolled-in_scale         56        117      0.662       0.62      0.682      0.329
             scratches         54         94      0.698      0.884      0.894       0.36

5.总结

遇到专栏的改进点如果存在涨点不明显或者掉点,建议将改进点放在网络不同位置进行可行性验证

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐