Gold-YOLO最新YOLO系列模型

news/2024/7/11 0:38:27 标签: YOLO, 深度学习, 人工智能

论文地址https://arxiv.org/pdf/2309.11331.pdf

代码地址https://github.com/huawei-noah/Efficient-Computing

目录

01论文介绍

01摘要

02模型训练过程

01安装环境

02修改train中参数

01修改--data-path参数

02修改--conf-file参数

03其他参数设置

03训练

04出现问题

01论文介绍

        Gold-YOLO是华为2023年9月在NeurIPS顶会上提出的有关yolo系列中普遍存在的FPN中的信息传输问题的解决方案。

01摘要

在过去的几年中,YOLO系列模型已经成为实时目标检测领域的领先方法。许多研究通过修改架构、增加数据和设计新的损失函数,将基线推向了更高的水平。然而以前的模型仍然存在信息融合问题,尽管特征金字塔网络(FPN)和路径聚合网络(PANet)已经在一定程度上缓解了这个问题。因此,本研究提出了一种先进的聚集和分发机制(GD机制),该机制通过卷积和自注意力操作实现。这种新设计的模型被称为Gold-YOLO,它提升了多尺度特征融合能力,在所有模型尺度上实现了延迟和准确性的理想平衡。此外,本文首次在YOLO系列中实现了MAE风格的预训练,使得YOLO系列模型能够从无监督预训练中受益。Gold-YOLO-N在COCO val2017数据集上实现了出色的39.9% AP,并在T4 GPU上实现了1030 FPS,超过了之前的SOTA模型YOLOv6-3.0-N,其FPS相似,但性能提升了2.4%。

02模型训练过程

模型代码

01安装环境

        在终端里输入安装依赖项

pip install -r requirements.txt

02修改train中参数

        找到def get_args_parser函数,对其下方参数修改

def get_args_parser(add_help=True):
    parser = argparse.ArgumentParser(description='YOLOv6 PyTorch Training', add_help=add_help)

01修改--data-path参数

        选择你的数据集格式,我是voc数据集格式,所有我复制data路径下voc.yaml改名pole。

parser.add_argument('--data-path', default='./data/coco.yaml', type=str, help='path of dataset')

        上面代码改为

    parser.add_argument('--data-path', default='./data/pole.yaml', type=str, help='path of dataset')

        进入到data/pole.yaml

# Please insure that your custom_dataset are put in same parent dir with YOLOv6_DIR
train: VOCdevkit/voc_07_12/images/train # train images
val: VOCdevkit/voc_07_12/images/val # val images
test: VOCdevkit/voc_07_12/images/val # test images (optional)
# whether it is coco dataset, only coco dataset should be set to True.
is_coco: False
# Classes
nc: 20  # number of classes
names: ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog',
        'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor']  # class names

        修改你的路径,我用的绝对路径,以及nc类别数量,以及各类名称,下面两种都可以。

# Please insure that your custom_dataset are put in same parent dir with YOLOv6_DIR
train: D:\DBSY\Efficient-Computing-master\Detection\Gold-YOLO\data\VOCdevkit\images/train # train images
val: D:\DBSY\Efficient-Computing-master\Detection\Gold-YOLO\data\VOCdevkit\images/train # val images
test: D:\DBSY\Efficient-Computing-master\Detection\Gold-YOLO\data\VOCdevkit\images/train # test images (optional)
is_coco: False
nc: 8  # number of classes
names: ['powerdirty', 'powerdirtyl', 'powerdirtys', 'lightdirty', 'lightdirtys', 'powerbreakb', 'powerbreak', 'powerbreakt']  # class names
#  0: powerdirty
#  1: powerdirtyl
#  2: powerdirtys
#  3: lightdirty
#  4: lightdirtys
#  5: powerbreakb
#  6: powerbreak
#  7: powerbreakt

        数据放置,我是在data/VOCdevkit路径下,创建了VOCdevkit,标签格式是txt。

        其中子目录下放置的是,images和labels两个文件夹,分别在这个两个文件夹下放置,train,val和test文件夹。以及分别放置标签。

02修改--conf-file参数

        这个是加载训练的文件,在configs路径下,里面有个几个,我选择了gold_yolo-m.py。

parser.add_argument('--conf-file', default='./configs/yolov6n.py', type=str, help='experiments description file')

         修改为,同样使用的绝对路径

    parser.add_argument('--conf-file', default=r'D:\DBSY\Efficient-Computing-master\Detection\Gold-YOLO\configs\gold_yolo-m.py', type=str, help='experiments description file')

03其他参数设置

        剩下的各种参数设置比较随意了

        --batch-size根据电脑来,我设为了4,设为8,16都行。
parser.add_argument('--batch-size', default=4, type=int, help='total batch size for all GPUs')
        --epochs,我没改让他跑400轮看看
    parser.add_argument('--epochs', default=400, type=int, help='number of total epochs to run')
        --workers这个几线程,一般电脑没有高线程,就改低,我是设为2.
    parser.add_argument('--workers', default=2, type=int, help='number of data loading workers (default: 8)')

       

        --device 设备,这个使用的GPU,默认是0,也就是使用第一个GPU. 
    parser.add_argument('--device', default='0', type=str, help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
        --eval-interval,评价相隔轮次,默认20轮评价一次,
    parser.add_argument('--eval-interval', default=20, type=int, help='evaluate at every interval epochs')

03训练

        直接在train.py中点击运行,开始训练

04出现问题

如果出报错,

File "D:\DBSY\Efficient-Computing-masteryolo\toolstrain.py"line 130,in <module>
main(args)
File"D:\DBSY\Efficient-Computtine 120, in maintrainer.train()File "D:\DBSY\Efficient-Computing-masten DetectionlGold-YOLOlyolov6 corelenginepy", line 109, in trainself.train_in_loop(self.epoch)
File "D:IDBSYIEfficient-Comouting-masteriDetectioniold-YOLO volovo core enaine.py". line 127, in train-in_loo
self.print_details()
File "D:\DBSY\Efficient-Computing-master\Detection\Gold-YOLO yolov6\coreengine.py"line 339,in print_detailsself.mean_loss = (self.mean_loss * self.step + self.loss_items)  (self.step + 1)AttributeError:'Trainer' object has no attribute  loss_items'

将你调用的哪个configs/gold_yolo-m.py路径下。其中type取值修改一下

     norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_cfg=dict(type='BN', requires_grad=True),


http://www.niftyadmin.cn/n/5174330.html

相关文章

100天精通风控建模(原理+Python实现)——第5天:风控建模中数据标准化是什么?

风控模型已在各大银行和公司都实际运用于业务,用于营销和风险控制等。    之前已经阐述了100天精通风控建模(原理+Python实现)——第1天:什么是风控建模?    100天精通风控建模(原理+Python实现)——第2天:风控建模有什么目的?    100天精通风控建模(原理+Python实现…

2.如何实现API统一响应-web组件篇

文章目录 1. 统一响应1.1 CommonResult 1. 统一响应 前端调用api接口获得统一的响应&#xff1a; 成功&#xff0c;返回成功的状态码和数据&#xff1b;失败&#xff0c;返回失败的状态码和错误提示。 在标准的 RESTful API 的定义&#xff0c;是推荐使用 HTTP 响应状态码 (…

结构型设计模式07-享元模式

结构型设计模式07-享元模式 1、享元模式介绍 享元模式是一种结构型设计模式&#xff0c;旨在通过共享对象来减少内存使用和提高性能。它主要用于处理大量细粒度对象的情况&#xff0c;其中许多对象具有相似的属性和行为。 在享元模式中&#xff0c;对象分为两种类型&#xf…

云端部署ChatGLM-6B

大模型这里更新是挺快的&#xff0c;我参考的视频教程就和我这个稍微有些不一样&#xff0c;这距离教程发布只过去4天而已… 不过基本操作也差不多 AutoDL算力云&#xff1a;https://www.autodl.com/home ChatGLM3&#xff1a;https://github.com/THUDM/ChatGLM3/tree/main Hug…

【PTE-day07 文件上传2】

1、常见的绕过方式 (1)畸形后缀名绕过 .php、.pht、.php3、.php4、.php5、.php2、.phtml、.pHp、.html、.Htm......(2)双写过滤字符绕过 (3).htaccess文件绕过 <FilesMatch "jpg"> SetHandler application/x-httpd-php

计算机毕业设计选题推荐-个人记账理财微信小程序/安卓APP-项目实战

✨作者主页&#xff1a;IT毕设梦工厂✨ 个人简介&#xff1a;曾从事计算机专业培训教学&#xff0c;擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。 ☑文末获取源码☑ 精彩专栏推荐⬇⬇⬇ Java项目 Py…

物联网AI MicroPython学习之语法 network网络配置模块

学物联网&#xff0c;来万物简单IoT物联网&#xff01;&#xff01; network介绍 模块功能&#xff1a; 用于管理Wi-Fi和以太网的网络模块参考用法&#xff1a; import network import time nic network.WLAN(network.STA_IF) nic.active(True) if not nic.isconnected():…

洛谷 NOIP 2023 模拟赛-汪了个汪-题解

简要题意 棋盘上有 n n n 行&#xff0c;第 i i i 行有 i i i 个格子。你要在格子填 1 ∼ n 1\sim n 1∼n&#xff0c;满足&#xff1a; 每行第一个数互不相同所有在行上相邻的两个数所组成的无序对互不相同每行的数互不相同 n ≤ 4000 n\le4000 n≤4000 题解 容易发现…