基于YOLOv8的暗光低光环境下(ExDark数据集)检测,加入多种优化方式---CVPR2024 DCNv4结合YOLOv9 SPPELAN二次创新,助力自动驾驶(三)

本文详细介绍了在ExDark低光数据集上使用YOLOv8进行模型训练,通过引入YOLOv9SPPELAN和DCNv4结构改进,实现了mAP@0.5从0.682提升至0.685。文章涵盖了数据集介绍、模型训练、结果分析和优化策略。
摘要由CSDN通过智能技术生成

  💡💡💡本文主要内容:详细介绍了暗光低光数据集检测整个过程,从数据集到训练模型到结果可视化分析,以及如何优化提升检测性能。

💡💡💡加入 CVPR2024 DCNv4结合YOLOv9 SPPELAN mAP@0.5由原始的0.682提升至0.685

 1.暗光低光数据集ExDark介绍

       低光数据集使用ExDark,该数据集是一个专门在低光照环境下拍摄出针对低光目标检测的数据集,包括从极低光环境到暮光环境等10种不同光照条件下的图片,包含图片训练集5891张,测试集1472张,12个类别。

1.Bicycle 2.Boat 3.Bottle 4.Bus 5.Car 6.Cat 7.Chair 8.Cup 9.Dog 10.Motorbike 11.People 12.Table

 

细节图:

 

2.基于YOLOv8的暗光低光检测

2.1 修改ExDark_yolo.yaml

path: ./data/ExDark_yolo/  # dataset root dir
train: images/train  # train images (relative to 'path') 1411 images
val: images/val  # val images (relative to 'path') 458 images
#test: images/test  # test images (optional) 937 images


names:
  0: Bicycle
  1: Boat
  2: Bottle
  3: Bus
  4: Car
  5: Cat
  6: Chair
  7: Cup
  8: Dog
  9: Motorbike
  10: People
  11: Table

2.2 开启训练 

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

if __name__ == '__main__':
    model = YOLO('ultralytics/cfg/models/v8/yolov8.yaml')
    model.train(data='data/ExDark_yolo/ExDark_yolo.yaml',
                cache=False,
                imgsz=640,
                epochs=200,
                batch=16,
                close_mosaic=10,
                workers=0,
                device='0',
                optimizer='SGD', # using SGD
                project='runs/train',
                name='exp',
                )

3.结果可视化分析 

YOLOv8 summary: 225 layers, 3012500 parameters, 0 gradients, 8.2 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 24/24 [00:25<00:00,  1.05s/it]
                   all        737       2404      0.743      0.609      0.682      0.427
               Bicycle        737        129      0.769      0.697      0.764      0.498
                  Boat        737        143       0.69       0.56      0.649      0.349
                Bottle        737        174      0.761      0.587      0.652      0.383
                   Bus        737         62      0.854      0.742      0.808       0.64
                   Car        737        311      0.789      0.672      0.761        0.5
                   Cat        737         95      0.783      0.568      0.661      0.406
                 Chair        737        232      0.725      0.513      0.609      0.363
                   Cup        737        181      0.725       0.53      0.609      0.375
                   Dog        737         94      0.634      0.617      0.628      0.421
             Motorbike        737         91      0.766      0.692       0.78      0.491
                People        737        744      0.789      0.603      0.711      0.398
                 Table        737        148      0.637       0.52      0.553      0.296

F1_curve.png:F1分数与置信度(x轴)之间的关系。F1分数是分类的一个衡量标准,是精确率和召回率的调和平均函数,介于0,1之间。越大越好。

TP:真实为真,预测为真;

FN:真实为真,预测为假;

FP:真实为假,预测为真;

TN:真实为假,预测为假;

精确率(precision)=TP/(TP+FP)

召回率(Recall)=TP/(TP+FN)

F1=2*(精确率*召回率)/(精确率+召回率)

 

PR_curve.png :PR曲线中的P代表的是precision(精准率)R代表的是recall(召回率),其代表的是精准率与召回率的关系。 

R_curve.png :召回率与置信度之间关系

results.png

 mAP_0.5:0.95表示从0.5到0.95以0.05的步长上的平均mAP.

 预测结果:

4.如何优化模型 

YOLOv8原创改进:原创自研 | CVPR2024 DCNv4结合YOLOv9 SPPELAN二次创新-CSDN博客

 CVPR2024 DCNv4结合YOLOv9 SPPELAN二次创新,结构图如下:

改进结构图:

 

4.2 对应yaml

# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv8 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=yolov8n.yaml' will call yolov8.yaml with scale 'n'
  # [depth, width, max_channels]
  n: [0.33, 0.25, 1024]  # YOLOv8n summary: 225 layers,  3157200 parameters,  3157184 gradients,   8.9 GFLOPs
  s: [0.33, 0.50, 1024]  # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients,  28.8 GFLOPs
  m: [0.67, 0.75, 768]   # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients,  79.3 GFLOPs
  l: [1.00, 1.00, 512]   # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs
  x: [1.00, 1.25, 512]   # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs

# YOLOv8.0n 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, 3, C2f, [128, True]]
  - [-1, 1, Conv, [256, 3, 2]]  # 3-P3/8
  - [-1, 6, C2f, [256, True]]
  - [-1, 1, Conv, [512, 3, 2]]  # 5-P4/16
  - [-1, 6, C2f, [512, True]]
  - [-1, 1, Conv, [1024, 3, 2]]  # 7-P5/32
  - [-1, 3, C2f, [1024, True]]
  - [-1, 1, SPPELAN_DCNV4, [1024, 512]]  # 9

# YOLOv8.0n head
head:
  - [-1, 1, nn.Upsample, [None, 2, 'nearest']]
  - [[-1, 6], 1, Concat, [1]]  # cat backbone P4
  - [-1, 3, C2f, [512]]  # 12

  - [-1, 1, nn.Upsample, [None, 2, 'nearest']]
  - [[-1, 4], 1, Concat, [1]]  # cat backbone P3
  - [-1, 3, C2f, [256]]  # 15 (P3/8-small)

  - [-1, 1, Conv, [256, 3, 2]]
  - [[-1, 12], 1, Concat, [1]]  # cat head P4
  - [-1, 3, C2f, [512]]  # 18 (P4/16-medium)

  - [-1, 1, Conv, [512, 3, 2]]
  - [[-1, 9], 1, Concat, [1]]  # cat head P5
  - [-1, 3, C2f, [1024]]  # 21 (P5/32-large)

  - [[15, 18, 21], 1, Detect, [nc]]  # Detect(P3, P4, P5)

4.3 实验结果分析

mAP@0.5由原始的0.682提升至0.685

YOLOv8-SPPELAN_DCNV4 summary: 243 layers, 6037940 parameters, 0 gradients, 10.2 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 12/12 [00:24<00:00,  2.06s/it]
                   all        737       2404      0.734      0.614      0.685      0.426
               Bicycle        737        129      0.709      0.705      0.767       0.49
                  Boat        737        143      0.695      0.573      0.652      0.347
                Bottle        737        174      0.722      0.596      0.654      0.385
                   Bus        737         62      0.826      0.758      0.808      0.626
                   Car        737        311      0.796      0.691      0.767        0.5
                   Cat        737         95      0.719      0.594      0.656      0.422
                 Chair        737        232      0.731      0.513      0.596      0.353
                   Cup        737        181      0.748      0.558      0.652      0.393
                   Dog        737         94      0.645      0.606      0.624      0.416
             Motorbike        737         91      0.812      0.712      0.809      0.502
                People        737        744      0.765       0.59      0.686      0.386
                 Table        737        148      0.638      0.473      0.548      0.292

5.系列篇

系列篇1: DCNv4结合SPPF ,助力自动驾驶

系列篇2:自研CPMS注意力,效果优于CBAM

系列篇3:DCNv4结合YOLOv9 SPPELAN

yolov8的小目标检测可以通过加入DCNv3来实现。DCNv3是可变形卷积网络的一种改进结构,被称为目标检测的"涨点神器",在yolov8中使用DCNv3可以提高3到4个点的性能。特别是对于小目标的检测效果较好。同时,还有其他一些方法可以用于提升yolov8的小目标检测性能,例如引入CVPR2023 InternImage中的新机制,扩展DCNv3,可以助力涨点,提高COCO的mAP指标。此外,还可以使用基于yolov5的轻量级上采样CARAFE算子,来提升小目标的检测性能。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [YOLOv8添加DCNv3可变形卷积](https://blog.csdn.net/weixin_70423469/article/details/131702564)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [涨点优化:基于Yolov5的红外小目标性能提升,多种网络结构组合DCNV3、CARAFE、多头检测器等](https://blog.csdn.net/m0_63774211/article/details/130881380)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI小怪兽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值