论文《YOLOv9: 使用可编程梯度信息学习你想学的内容》的实现
<div align="center"> <a href="./"> <img src="https://yellow-cdn.veclightyear.com/835a84d5/7d7ad80b-5d3f-4b35-9907-b3921dadd974.png" width="79%"/> </a> </div>MS COCO
| 模型 | 测试尺寸 | AP<sup>验证集</sup> | AP<sub>50</sub><sup>验证集</sup> | AP<sub>75</sub><sup>验证集</sup> | 参数量 | FLOPs |
|---|---|---|---|---|---|---|
| YOLOv9-T | 640 | 38.3% | 53.1% | 41.3% | 2.0M | 7.7G |
| YOLOv9-S | 640 | 46.8% | 63.4% | 50.7% | 7.1M | 26.4G |
| YOLOv9-M | 640 | 51.4% | 68.1% | 56.1% | 20.0M | 76.3G |
| YOLOv9-C | 640 | 53.0% | 70.2% | 57.8% | 25.3M | 102.1G |
| YOLOv9-E | 640 | 55.6% | 72.8% | 60.6% | 57.3M | 189.0G |
自定义训练: https://github.com/WongKinYiu/yolov9/issues/30#issuecomment-1960955297
ONNX导出: https://github.com/WongKinYiu/yolov9/issues/2#issuecomment-1960519506 https://github.com/WongKinYiu/yolov9/issues/40#issue-2150697688 https://github.com/WongKinYiu/yolov9/issues/130#issue-2162045461
分割任务的ONNX导出: https://github.com/WongKinYiu/yolov9/issues/260#issue-2191162150
TensorRT推理: https://github.com/WongKinYiu/yolov9/issues/143#issuecomment-1975049660 https://github.com/WongKinYiu/yolov9/issues/34#issue-2150393690 https://github.com/WongKinYiu/yolov9/issues/79#issue-2153547004 https://github.com/WongKinYiu/yolov9/issues/143#issue-2164002309
QAT TensorRT: https://github.com/WongKinYiu/yolov9/issues/327#issue-2229284136 https://github.com/WongKinYiu/yolov9/issues/253#issue-2189520073
分割任务的TensorRT推理: https://github.com/WongKinYiu/yolov9/issues/446
TFLite: https://github.com/WongKinYiu/yolov9/issues/374#issuecomment-2065751706
OpenVINO: https://github.com/WongKinYiu/yolov9/issues/164#issue-2168540003
C# ONNX推理: https://github.com/WongKinYiu/yolov9/issues/95#issue-2155974619
C# OpenVINO推理: https://github.com/WongKinYiu/yolov9/issues/95#issuecomment-1968131244
OpenCV: https://github.com/WongKinYiu/yolov9/issues/113#issuecomment-1971327672
Hugging Face演示: https://github.com/WongKinYiu/yolov9/issues/45#issuecomment-1961496943
CoLab演示: https://github.com/WongKinYiu/yolov9/pull/18
ONNXSlim导出: https://github.com/WongKinYiu/yolov9/pull/37
YOLOv9 ROS: https://github.com/WongKinYiu/yolov9/issues/144#issue-2164210644
YOLOv9 ROS TensorRT: https://github.com/WongKinYiu/yolov9/issues/145#issue-2164218595
YOLOv9 Julia: https://github.com/WongKinYiu/yolov9/issues/141#issuecomment-1973710107
YOLOv9 MLX: https://github.com/WongKinYiu/yolov9/issues/258#issue-2190586540
YOLOv9 StrongSORT与OSNet: https://github.com/WongKinYiu/yolov9/issues/299#issue-2212093340
YOLOv9 ByteTrack: https://github.com/WongKinYiu/yolov9/issues/78#issue-2153512879
YOLOv9 DeepSORT: https://github.com/WongKinYiu/yolov9/issues/98#issue-2156172319
YOLOv9计数: https://github.com/WongKinYiu/yolov9/issues/84#issue-2153904804
YOLOv9速度估计: https://github.com/WongKinYiu/yolov9/issues/456
YOLOv9人脸检测: https://github.com/WongKinYiu/yolov9/issues/121#issue-2160218766
YOLOv9分割onnxruntime: https://github.com/WongKinYiu/yolov9/issues/151#issue-2165667350
Comet日志记录: https://github.com/WongKinYiu/yolov9/pull/110
MLflow日志记录: https://github.com/WongKinYiu/yolov9/pull/87
AnyLabeling工具: https://github.com/WongKinYiu/yolov9/issues/48#issue-2152139662
AX650N部署: https://github.com/WongKinYiu/yolov9/issues/96#issue-2156115760
Conda环境: https://github.com/WongKinYiu/yolov9/pull/93
AutoDL docker环境: https://github.com/WongKinYiu/yolov9/issues/112#issue-2158203480
</details>Docker环境(推荐)
<details><summary> <b>展开</b> </summary></details># 创建docker容器,如果你有更多内存可以更改共享内存大小 nvidia-docker run --name yolov9 -it -v your_coco_path/:/coco/ -v your_code_path/:/yolov9 --shm-size=64g nvcr.io/nvidia/pytorch:21.11-py3 # apt安装必要的包 apt update apt install -y zip htop screen libgl1-mesa-glx # pip安装必要的包 pip install seaborn thop # 进入代码文件夹 cd /yolov9
yolov9-s-converted.pt yolov9-m-converted.pt yolov9-c-converted.pt yolov9-e-converted.pt
yolov9-s.pt yolov9-m.pt yolov9-c.pt yolov9-e.pt
gelan-s.pt gelan-m.pt gelan-c.pt gelan-e.pt
# 评估转换后的yolov9模型 python val.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.7 --device 0 --weights './yolov9-c-converted.pt' --save-json --name yolov9_c_c_640_val # 评估yolov9模型 # python val_dual.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.7 --device 0 --weights './yolov9-c.pt' --save-json --name yolov9_c_640_val # 评估gelan模型 # python val.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.7 --device 0 --weights './gelan-c.pt' --save-json --name gelan_c_640_val
你将得到以下结果:
平均精度 (AP) @[ IoU=0.50:0.95 | 面积= 所有 | 最大检测数=100 ] = 0.530
平均精度 (AP) @[ IoU=0.50 | 面积= 所有 | 最大检测数=100 ] = 0.702
平均精度 (AP) @[ IoU=0.75 | 面积= 所有 | 最大检测数=100 ] = 0.578
平均精度 (AP) @[ IoU=0.50:0.95 | 面积= 小 | 最大检测数=100 ] = 0.362
平均精度 (AP) @[ IoU=0.50:0.95 | 面积= 中 | 最大检测数=100 ] = 0.585
平均精度 (AP) @[ IoU=0.50:0.95 | 面积= 大 | 最大检测数=100 ] = 0.693
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 所有 | 最大检测数= 1 ] = 0.392
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 所有 | 最大检测数= 10 ] = 0.652
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 所有 | 最大检测数=100 ] = 0.702
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 小 | 最大检测数=100 ] = 0.541
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 中 | 最大检测数=100 ] = 0.760
平均召回率 (AR) @[ IoU=0.50:0.95 | 面积= 大 | 最大检测数=100 ] = 0.844
数据准备
bash scripts/get_coco.sh
单GPU训练
# 训练yolov9模型 python train_dual.py --workers 8 --device 0 --batch 16 --data data/coco.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15 # 训练gelan模型 # python train.py --workers 8 --device 0 --batch 32 --data data/coco.yaml --img 640 --cfg models/detect/gelan-c.yaml --weights '' --name gelan-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15
多GPU训练
# 训练yolov9模型 python -m torch.distributed.launch --nproc_per_node 8 --master_port 9527 train_dual.py --workers 8 --device 0,1,2,3,4,5,6,7 --sync-bn --batch 128 --data data/coco.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15 # 训练gelan模型 # python -m torch.distributed.launch --nproc_per_node 4 --master_port 9527 train.py --workers 8 --device 0,1,2,3 --sync-bn --batch 128 --data data/coco.yaml --img 640 --cfg models/detect/gelan-c.yaml --weights '' --name gelan-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15
# 使用转换后的yolov9模型进行推理 python detect.py --source './data/images/horses.jpg' --img 640 --device 0 --weights './yolov9-c-converted.pt' --name yolov9_c_c_640_detect # 使用yolov9模型进行推理 # python detect_dual.py --source './data/images/horses.jpg' --img 640 --device 0 --weights './yolov9-c.pt' --name yolov9_c_640_detect # 使用gelan模型进行推理 # python detect.py --source './data/images/horses.jpg' --img 640 --device 0 --weights './gelan-c.pt' --name gelan_c_c_640_detect
@article{wang2024yolov9,
title={{YOLOv9}: 使用可编程梯度信息学习你想学习的内容},
author={Wang, Chien-Yao and Liao, Hong-Yuan Mark},
booktitle={arXiv preprint arXiv:2402.13616},
year={2024}
}
@article{chang2023yolor,
title={基于{YOLOR}的多任务学习},
author={Chang, Hung-Shuo and Wang, Chien-Yao and Wang, Richard Robert and Chou, Gene and Liao, Hong-Yuan Mark},
journal={arXiv preprint arXiv:2309.16921},
year={2023}
}
基于YOLOR的多任务学习的部分代码已在此仓 库中发布。
<div align="center"> <a href="./"> <img src="https://yellow-cdn.veclightyear.com/835a84d5/b1738715-6c3f-43d4-943e-cb759303bb4f.png" width="99%"/> </a> </div>目标检测
# coco/labels/{split}/*.txt # 边界框或多边形(每个实例占一行) python train.py --workers 8 --device 0 --batch 32 --data data/coco.yaml --img 640 --cfg models/detect/gelan-c.yaml --weights '' --name gelan-c-det --hyp hyp.scratch-high.yaml --min-items 0 --epochs 300 --close-mosaic 10
| 模型 | 测试尺寸 | 参数量 | FLOPs | AP<sup>box</sup> |
|---|---|---|---|---|
| GELAN-C-DET | 640 | 25.3M | 102.1G | 52.3% |
| YOLOv9-C-DET | 640 | 25.3M | 102.1G | 53.0% |
目标检测 实例分割
# coco/labels/{split}/*.txt # 多边形(每个实例占一行) python segment/train.py --workers 8 --device 0 --batch 32 --data coco.yaml --img 640 --cfg models/segment/gelan-c-seg.yaml --weights '' --name gelan-c-seg --hyp hyp.scratch-high.yaml --no-overlap --epochs 300 --close-mosaic 10
| 模型 | 测试尺寸 | 参数量 | FLOPs | AP<sup>box</sup> | AP<sup>mask</sup> |
|---|---|---|---|---|---|
| GELAN-C-SEG | 640 | 27.4M | 144.6G | 52.3% | 42.4% |
| YOLOv9-C-SEG | 640 | 27.4M | 145.5G | 53.3% | 43.5% |
目标检测 实例分割 语义分割 场景分割 全景分割
# coco/labels/{split}/*.txt # 多边形(每个实例占一行) # coco/stuff/{split}/*.txt # 多边形(每个语义类别占一行) python panoptic/train.py --workers 8 --device 0 --batch 32 --data coco.yaml --img 640 --cfg models/panoptic/gelan-c-pan.yaml --weights '' --name gelan-c-pan --hyp hyp.scratch-high.yaml --no-overlap --epochs 300 --close-mosaic 10
| 模型 | 测试尺寸 | 参数量 | 浮点运算量 | AP<sup>框</sup> | AP<sup>掩码</sup> | mIoU<sub>164k/10k</sub><sup>语义</sup> | mIoU<sup>物体</sup> | PQ<sup>全景</sup> |
|---|---|---|---|---|---|---|---|---|
| GELAN-C-PAN | 640 | 27.6M | 146.7G | 52.6% | 42.5% | 39.0%/48.3% | 52.7% | 39.4% |
| YOLOv9-C-PAN | 640 | 28.8M | 187.0G | 52.7% | 43.0% | 39.8%/- | 52.2% | 40.5% |
目标检测 实例分割 语义分割 物体分割 全景分割 图像描述
# coco/labels/{split}/*.txt # 多边形 (每行1个实例) # coco/stuff/{split}/*.txt # 多边形 (每行1个语义) # coco/annotations/*.json # json (每个分割1个文件) python caption/train.py --workers 8 --device 0 --batch 32 --data coco.yaml --img 640 --cfg models/caption/gelan-c-cap.yaml --weights '' --name gelan-c-cap --hyp hyp.scratch-high.yaml --no-overlap --epochs 300 --close-mosaic 10
| 模型 | 测试尺寸 | 参数量 | 浮点运算量 | AP<sup>框</sup> | AP<sup>掩码</sup> | mIoU<sub>164k/10k</sub><sup>语义</sup> | mIoU<sup>物体</sup> | PQ<sup>全景</sup> | BLEU@4<sup>描述</sup> | CIDEr<sup>描述</sup> |
|---|---|---|---|---|---|---|---|---|---|---|
| GELAN-C-CAP | 640 | 47.5M | - | 51.9% | 42.6% | 42.5%/- | 56.5% | 41.7% | 38.8 | 122.3 |
| YOLOv9-C-CAP | 640 | 47.5M | - | 52.1% | 42.6% | 43.0%/- | 56.4% | 42.1% | 39.1 | 122.0 |
<详情><摘要> <b>展开</b> </摘要>
</详情>


全球首个AI音乐社区
音述AI是全球首个AI音乐社区,致力让每个人都能用音乐表达自我。音述AI提供零门槛AI创作工具,独创GETI法则帮助用户精准定义音乐风格,AI润色功能支持自动优化作品质感。音述AI支持交流讨论、二次创作与价值变现。针对中文用户的语言习惯与文化背景进行专门优化,支持国风融合、C-pop等本土音乐标签,让技术更好地承载人文表达。


一站式搞定所有学习需求
不再被海量信息淹没,开始真正理解知识。Lynote 可摘要 YouTube 视频、PDF、文章等内容。即时创建笔记,检测 AI 内容并下载资料,将您的学习效率提升 10 倍。


为AI短剧协作而生
专为AI短剧协作而生的AniShort正式发布,深度重构AI短剧全流程生产模式,整合创意策划、制作执行、实时协作、在线审片、资产复用等全链路功能,独创无限画布、双轨并行工业化工作流与Ani智能体助手,集成多款主流AI大模型,破解素材零散、版本混乱、沟通低效等行业痛点,助力3人团队效率提升800%,打造标准化、可追溯的AI短剧量产体系,是AI短剧团队协同创作、提升制作效率的核心工具。


能听懂你表达的视频模型
Seedance two是基于seedance2.0的中国大模型,支持图像、视频、音频、文本四种模态输入,表达方式更丰富,生成也更可控。


国内直接访问,限时3折
输入简单文字,生成想要的图片,纳米香蕉中文站基于 Google 模型的 AI 图片生成网站,支持文字生图、图生图。官网价格限时3折活动


职场AI,就用扣子
AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!


多风格AI绘画神器
堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。


零代码AI应用开发平台
零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。


免费创建高清无水印Sora视频
Vora是一个免费创建高清无水印Sora视频的AI工具


最适合小白的AI自动化工作流平台
无需编码,轻松生成可复用、可变现的AI自动化工作流
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号