{"id":19001196,"url":"https://github.com/oneflow-inc/one-yolov5","last_synced_at":"2025-04-09T10:07:44.995Z","repository":{"id":57754061,"uuid":"456460315","full_name":"Oneflow-Inc/one-yolov5","owner":"Oneflow-Inc","description":"A more efficient yolov5 with oneflow backend 🎉🎉🎉","archived":false,"fork":false,"pushed_at":"2024-05-10T15:24:25.000Z","size":109815,"stargazers_count":215,"open_issues_count":10,"forks_count":20,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-02T07:11:16.337Z","etag":null,"topics":["deep-learning","oneflow","yolov5"],"latest_commit_sha":null,"homepage":"https://start.oneflow.org/oneflow-yolo-doc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oneflow-Inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-07T10:35:35.000Z","updated_at":"2025-01-10T05:41:56.000Z","dependencies_parsed_at":"2023-09-24T17:32:16.738Z","dependency_job_id":"206e7264-b5ed-4c09-8728-89e9460fd84e","html_url":"https://github.com/Oneflow-Inc/one-yolov5","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2Fone-yolov5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2Fone-yolov5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2Fone-yolov5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2Fone-yolov5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oneflow-Inc","download_url":"https://codeload.github.com/Oneflow-Inc/one-yolov5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","oneflow","yolov5"],"created_at":"2024-11-08T18:10:19.332Z","updated_at":"2025-04-09T10:07:44.956Z","avatar_url":"https://github.com/Oneflow-Inc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003ccenter\u003e \n\u003cimg src=\"https://user-images.githubusercontent.com/35585791/223076182-abdca39b-3084-472d-a377-7bbaa640b6f0.png\"\u003e\n\u003c/center\u003e\n\n\u003e 写在前面：本项目是基于 ultralytics 版 YOLOv5 源码改成 OneFlow 后端的结果，本工程的目的是做一个拥有更快训练速度的 YOLOv5 ，同时提供丰富的中文教程和源码细节解读，使得读者可以更加深入的了解 YOLOv5 。本 README 的其中一些部分也是直接用的 ultralytics 版 YOLOv5 README 的翻译，我们将相关链接替换为了 OneFlow 后端 YOLOv5 对应的链接。\n\n### \u003cdiv align=\"center\"\u003e最近新闻\u003c/div\u003e\n\n- 🌟 v1.2.0 正式开源。v1.2.0同步了ultralytics yolov5的v7.0版本，同时支持分类，目标检测，实例分割等任务 详情请看：[Release Note](https://github.com/Oneflow-Inc/one-yolov5/releases/tag/v1.2.0)\n\u003ctable border=\"1px\" cellpadding=\"10px\"\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/109639975/220929631-9baf1d12-8cfc-4e9f-985e-372302b672dc.jpg\" height=\"280px\"  width=\"575px\"  \u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/109639975/220928826-84ed25bc-a72e-46ab-8b9c-c3a2b57ded18.jpg\" height=\"280\"  width=\"575px\" \u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/109639975/220929320-9f4cf581-43b9-4609-8b51-346c84ac0d62.jpg\" height=\"280\"  width=\"575px\" \u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/109639975/220930143-aa022378-4b6f-4ffc-81bf-3e6032d4862c.jpg\" height=\"280\"  width=\"575px\" \u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr  \u003e\n            \u003ctd \u003e\n                原图 \n            \u003c/td\u003e\n            \u003ctd  \u003e\n               目标检测: 目标检测是指从图像中检测出多个物体并标记它们的位置和类别。目标检测任务需要给出物体的类别和位置信息，通常使用边界框（bounding box）来表示。目标检测可以应用于自动驾驶、视频监控、人脸识别等领域。\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr  \u003e\n            \u003ctd \u003e\n               图像分类:  图像分类是指给定一张图像，通过计算机视觉技术来判断它属于哪一类别。\n图像分类是一种有监督学习任务，需要通过训练样本和标签来建立分类模型。在图像分类中，算法需要提取图像的特征，然后将其分类为预定义的类别之一。例如，图像分类可以用于识别手写数字、识别动物、区分汽车和自行车等。\n            \u003c/td\u003e\n            \u003ctd \u003e\n            实例分割: 实例分割是指从图像中检测出多个物体并标记它们的位置和类别，同时对每个物体进行像素级的分割。\n实例分割要求更为精细的信息，因为它需要将物体的每个像素都分配给对应的物体。 \n实例分割可以应用于医学影像分析、自动驾驶、虚拟现实等领域。\n            \u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/table\u003e\n\n- 🎉 [代码仓库地址](https://github.com/Oneflow-Inc/one-yolov5)\n- 🎉 [文档网站地址](https://start.oneflow.org/oneflow-yolo-doc/index.html)\n- 🎉 [OneFlow 安装方法](https://github.com/Oneflow-Inc/oneflow#install-oneflow) (注意⚠️： 目前OneFlow 需要安装 nightly 版本，等OneFlow后续新版本发布后可以安装稳定版。此外 OneFlow 目前仅对Linux平台有完整支持，请 Windows 和 Macos 用户注意)\n\n不过即使你对 OneFlow 带来的性能提升不感兴趣，我们相信[OneYOLOv5文档网站](https://start.oneflow.org/oneflow-yolo-doc/index.html)中对 ultralytics/yolov5 相关教程的汉化以及源码剖析也会是从零开始深入学习 YOLOv5 一份不错的资料。欢迎在仓库给我们提出宝贵的意见。🌟🌟🌟\n\n## \u003cdiv align=\"center\"\u003e文档\u003c/div\u003e\n\n请查看 [文档网站](https://start.oneflow.org/oneflow-yolo-doc/index.html) 获取关于训练，测试和推理的完整文档。\n\n# 快速开始案例\n\n注意⚠️:\n\n- oneflow目前不支持windows平台\n\n- --batch 必须是GPU数量的倍数。\n\n- GPU 0 将比其他GPU占用略多的内存，因为它维护EMA并负责检查点等。\n\n## \u003cdiv align=\"center\"\u003e快速开始案例\u003c/div\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e安装\u003c/summary\u003e\n\n在[**Python\u003e=3.7.0**](https://www.python.org/) 的环境中克隆版本仓并安装 [requirements.txt](https://github.com/Oneflow-Inc/one-yolov5/blob/main/requirements.txt)，包括 [OneFlow nightly](https://docs.oneflow.org/master/index.html) 。\n\n\n```bash\ngit clone https://github.com/Oneflow-Inc/one-yolov5  # 克隆\ncd one-yolov5\npip install -r requirements.txt  # 安装\n```\n\n\u003c/details\u003e\n\n\n### Train \nYOLOv5实例分割模型支持使用 `--data coco128-seg.yaml`  参数自动下载 `COCO128-seg` 测试数据集(*测试数据集表示能测试项目正常运行的小数据集*)， 以及使用 `bash data/scripts/get_coco.sh --train --val --segments`  或者使用  `python train.py --data coco.yaml`  下载 `COCO-segments` 数据集\n\n```shell\n# Single-GPU\npython segment/train.py --weights yolov5s-seg.of --data coco128-seg.yaml --epochs 5 --img 640\n\n# Multi-GPU DDP\npython -m oneflow.distributed.launch --nproc_per_node  4  segment/train.py --weights yolov5s-seg.of --data coco128-seg.yaml --epochs 5 --img 640 --device 0,1,2,3\n```\n\n注意 :\n- {`.of`: 代表OneFlow预训练权重 , `.pt`: 代表 PyTorch 预训练权重 }\n- `--weights yolov5s-seg.of`  表示使用OneFlow预训练权重 , 也是支持使用 PyTorch 预训练权重 如 `--weights yolov5s-seg.pt`\n- 模型权重将自动从 github 下载(*建议如果没有设置代理，可以提前将模型下载到电脑本地 使用 `--weights 本地路径/yolov5s-seg.of`*)\n\n### val \n\n在ImageNet-1k数据集上验证YOLOv5m-seg 模型的精度\n\n```shell \nbash data/scripts/get_coco.sh --val --segments  # download COCO val segments split (780MB, 5000 images)\npython segment/val.py --weights yolov5s-seg.of --data coco.yaml --img 640  # validate\n```\n\n### Predict \n\n使用预训练模型(YOLOv5m-seg) 预测图片\n\n```shell\npython segment/predict.py --weights yolov5m-seg.of --data data/images/\n```\n\n![image](https://user-images.githubusercontent.com/118866310/223043320-ba3599d9-a3a4-4590-af98-65da1e3f228c.png)\n\n### Export\n\n将 `yolov5s-seg` 模型导出为 ONNX 格式 示例\n```shell\npython export.py --weights yolov5s-seg.of --include onnx  --img 640 --device 0\n```\n\n\n\n\n## \u003cdiv align=\"center\"\u003e为什么选择 one-yolov5\u003c/div\u003e\n\n[消费级显卡的春天，GTX 3090 YOLOv5s单卡完整训练COCO数据集缩短11.35个小时](https://start.oneflow.org/oneflow-yolo-doc/tutorials/00_chapter/optim_speed_version1.html)\n\n\n### CheckPoints\n\u003e 注意: 这里的模型权重为v1.1.0版本的权重，最新权重下载 [releases/tag/v1.2.0](https://github.com/Oneflow-Inc/one-yolov5/releases/tag/v1.2.0)\n\n| 模型                                                                                                        | ONNX版本模型                                                                                      | 规模\u003cbr\u003e\u003csup\u003e(像素) | mAP\u003csup\u003e验证\u003cbr\u003e0.5:0.95 | mAP\u003csup\u003e验证\u003cbr\u003e0.5 | 速度\u003cbr\u003e\u003csup\u003eCPU b1\u003cbr\u003e(ms) | 速度\u003cbr\u003e\u003csup\u003eV100 b1\u003cbr\u003e(ms) | 速度\u003cbr\u003e\u003csup\u003eV100 b32\u003cbr\u003e(ms) | 参数\u003cbr\u003e\u003csup\u003e(M) | 浮点运算\u003cbr\u003e\u003csup\u003e@640 (B) |\n| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------- | ------------------------ | ------------------- | --------------------------- | ---------------------------- | ----------------------------- | ---------------- | ------------------------- |\n| [YOLOv5n](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5n.zip)                   | [YOLOv5n.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5n.onnx)   | 640                 | 28.0                     | 45.7                | **45**                      | **6.3**                      | **0.6**                       | **1.9**          | **4.5**                   |\n| [YOLOv5s](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5s.zip)                   | [YOLOv5s.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5s.onnx)   | 640                 | 37.4                     | 56.8                | 98                          | 6.4                          | 0.9                           | 7.2              | 16.5                      |\n| [YOLOv5m](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5m.zip)                   | [YOLOv5m.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5m.onnx)   | 640                 | 45.4                     | 64.1                | 224                         | 8.2                          | 1.7                           | 21.2             | 49.0                      |\n| [YOLOv5l](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5l.zip)                   | [YOLOv5l.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5l.onnx)   | 640                 | 49.0                     | 67.3                | 430                         | 10.1                         | 2.7                           | 46.5             | 109.1                     |\n| [YOLOv5x](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5x.zip)                   | [YOLOv5x.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5x.onnx)   | 640                 | 50.7                     | 68.9                | 766                         | 12.1                         | 4.8                           | 86.7             | 205.7                     |\n|                                                                                                             |                                                                                                   |                     |                          |                     |                             |                              |                               |                  |                           |\n| [YOLOv5n6](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5n6.zip)                 | [YOLOv5n6.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5n6.onnx) | 1280                | 36.0                     | 54.4                | 153                         | 8.1                          | 2.1                           | 3.2              | 4.6                       |\n| [YOLOv5s6](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5s6.zip)                 | [YOLOv5s6.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5s6.onnx) | 1280                | 44.8                     | 63.7                | 385                         | 8.2                          | 3.6                           | 12.6             | 16.8                      |\n| [YOLOv5m6](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5m6.zip)                 | [YOLOv5m6.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5m6.onnx) | 1280                | 51.3                     | 69.3                | 887                         | 11.1                         | 6.8                           | 35.7             | 50.0                      |\n| [YOLOv5l6](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5l6.zip)                 | [YOLOv5l6.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5l6.onnx) | 1280                | 53.7                     | 71.3                | 1784                        | 15.8                         | 10.5                          | 76.8             | 111.4                     |\n| [YOLOv5x6](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.0.0/yolov5x6.zip)\u003cbr\u003e+ [TTA][TTA] | [YOLOv5x6.onnx](https://github.com/Oneflow-Inc/one-yolov5/releases/download/v1.1.0/yolov5x6.onnx) | 1280\u003cbr\u003e1536        | 55.0\u003cbr\u003e**55.8**         | 72.7\u003cbr\u003e**72.7**    | 3136\u003cbr\u003e-                   | 26.2\u003cbr\u003e-                    | 19.4\u003cbr\u003e-                     | 140.7\u003cbr\u003e-       | 209.8\u003cbr\u003e-                |\n\n\n\u003cdetails\u003e\n  \u003csummary\u003e表格注释 (点击扩展)\u003c/summary\u003e\n\n- 所有检查点都以默认设置训练到300个时期. Nano和Small模型用 [hyp.scratch-low.yaml](https://github.com/Oneflow-Inc/one-yolov5/blob/master/data/hyps/hyp.scratch-low.yaml) hyps, 其他模型使用 [hyp.scratch-high.yaml](https://github.com/Oneflow-Inc/one-yolov5/blob/master/data/hyps/hyp.scratch-high.yaml).\n- **mAP\u003csup\u003eval\u003c/sup\u003e** 值是 [COCO val2017](http://cocodataset.org) 数据集上的单模型单尺度的值。\n\u003cbr\u003e复现方法: `python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65`\n- 使用 [AWS p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) 实例对COCO val图像的平均速度。不包括NMS时间（~1 ms/img)\n\u003cbr\u003e复现方法: `python val.py --data coco.yaml --img 640 --task speed --batch 1`\n- **TTA** [测试时数据增强](https://github.com/ultralytics/yolov5/issues/303) 包括反射和比例增强.\n\u003cbr\u003e复现方法: `python val.py --data coco.yaml --img 1536 --iou 0.7 --augment`\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneflow-inc%2Fone-yolov5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneflow-inc%2Fone-yolov5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneflow-inc%2Fone-yolov5/lists"}