ultralytics/yolov5: v7.0 - YOLOv5 SOTA Realtime Instance Segmentation
Creators
- Glenn Jocher1
- Ayush Chaurasia
- Alex Stoken2
- Jirka Borovec3
- NanoCode012
- Yonghye Kwon4
- Kalen Michael
- TaoXie5
- Jiacong Fang
- imyhxy
- Lorna6
- 曾逸夫(Zeng Yifu)
- Colin Wong7
- Abhiram V8
- Diego Montes
- Zhiqiang Wang9
- Cristi Fati
- Jebastin Nadar
- Laughing
- UnglvKitDe
- Victor Sonck
- tkianai10
- yxNONG
- Piotr Skalski11
- Adam Hogan12
- Dhruv Nair
- Max Strobel13
- Mrinal Jain14
- 1. @ultralytics
- 2. Jacobs JETS @ NASA Johnson Space Center
- 3. Grid.ai | PytorchLightning
- 4. MarkAny
- 5. 罗布乐思
- 6. Dakewe Biotech Co., Ltd.
- 7. @frc5431 @Rebirth-of-the-Night
- 8. @zealabs
- 9. @AXERA-TECH
- 10. 别怕失败,大不了从头来过
- 11. @roboflow-ai
- 12. North Carolina State University
- 13. Technische Universität München
- 14. Ephesoft
Description
<div align="center"> <a align="center" href="https://ultralytics.com/yolov5" target="_blank"> <img width="850" src="https://github.com/ultralytics/assets/blob/master/yolov5/v70/splash.png"></a> </div> <br>
Our new YOLOv5 v7.0 instance segmentation models are the fastest and most accurate in the world, beating all current SOTA benchmarks. We've made them super simple to train, validate and deploy. See full details in our Release Notes and visit our YOLOv5 Segmentation Colab Notebook for quickstart tutorials.
<div align="center"> <a align="center" href="https://ultralytics.com/yolov5" target="_blank"> <img width="800" src="https://user-images.githubusercontent.com/26833433/203348073-9b85607b-03e2-48e1-a6ba-fe1c1c31749c.png"></a> </div> <br>
Our primary goal with this release is to introduce super simple YOLOv5 segmentation workflows just like our existing object detection models. The new v7.0 YOLOv5-seg models below are just a start, we will continue to improve these going forward together with our existing detection and classification models. We'd love your feedback and contributions on this effort!
This release incorporates 280 PRs from 41 contributors since our last release in August 2022.
Important Updates- Segmentation Models ⭐ NEW: SOTA YOLOv5-seg COCO-pretrained segmentation models are now available for the first time (https://github.com/ultralytics/yolov5/pull/9052 by @glenn-jocher, @AyushExel and @Laughing-q)
- Paddle Paddle Export: Export any YOLOv5 model (cls, seg, det) to Paddle format with python export.py --include paddle (https://github.com/ultralytics/yolov5/pull/9459 by @glenn-jocher)
- YOLOv5 AutoCache: Use
python train.py --cache ram
will now scan available memory and compare against predicted dataset RAM usage. This reduces risk in caching and should help improve adoption of the dataset caching feature, which can significantly speed up training. (https://github.com/ultralytics/yolov5/pull/10027 by @glenn-jocher) - Comet Logging and Visualization Integration: Free forever, Comet lets you save YOLOv5 models, resume training, and interactively visualise and debug predictions. (https://github.com/ultralytics/yolov5/pull/9232 by @DN6)
We trained YOLOv5 segmentations models on COCO for 300 epochs at image size 640 using A100 GPUs. We exported all models to ONNX FP32 for CPU speed tests and to TensorRT FP16 for GPU speed tests. We ran all speed tests on Google Colab Pro notebooks for easy reproducibility.
Model | size<br><sup>(pixels) | mAP<sup>box<br>50-95 | mAP<sup>mask<br>50-95 | Train time<br><sup>300 epochs<br>A100 (hours) | Speed<br><sup>ONNX CPU<br>(ms) | Speed<br><sup>TRT A100<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>@640 (B) |
---|---|---|---|---|---|---|---|---|
YOLOv5n-seg | 640 | 27.6 | 23.4 | 80:17 | 62.7 | 1.2 | 2.0 | 7.1 |
YOLOv5s-seg | 640 | 37.6 | 31.7 | 88:16 | 173.3 | 1.4 | 7.6 | 26.4 |
YOLOv5m-seg | 640 | 45.0 | 37.1 | 108:36 | 427.0 | 2.2 | 22.0 | 70.8 |
YOLOv5l-seg | 640 | 49.0 | 39.9 | 66:43 (2x) | 857.4 | 2.9 | 47.9 | 147.7 |
YOLOv5x-seg | 640 | 50.7 | 41.4 | 62:56 (3x) | 1579.2 | 4.5 | 88.8 | 265.7 |
- All checkpoints are trained to 300 epochs with SGD optimizer with
lr0=0.01
andweight_decay=5e-5
at image size 640 and all default settings.<br>Runs logged to https://wandb.ai/glenn-jocher/YOLOv5_v70_official - Accuracy values are for single-model single-scale on COCO dataset.<br>Reproduce by
python segment/val.py --data coco.yaml --weights yolov5s-seg.pt
- Speed averaged over 100 inference images using a Colab Pro A100 High-RAM instance. Values indicate inference speed only (NMS adds about 1ms per image). <br>Reproduce by
python segment/val.py --data coco.yaml --weights yolov5s-seg.pt --batch 1
- Export to ONNX at FP32 and TensorRT at FP16 done with
export.py
. <br>Reproduce bypython export.py --weights yolov5s-seg.pt --include engine --device 0 --half
YOLOv5 segmentation training supports auto-download COCO128-seg segmentation dataset with --data coco128-seg.yaml
argument and manual download of COCO-segments dataset with bash data/scripts/get_coco.sh --train --val --segments
and then python train.py --data coco.yaml
.
# Single-GPU
python segment/train.py --model yolov5s-seg.pt --data coco128-seg.yaml --epochs 5 --img 640
# Multi-GPU DDP
python -m torch.distributed.run --nproc_per_node 4 --master_port 1 segment/train.py --model yolov5s-seg.pt --data coco128-seg.yaml --epochs 5 --img 640 --device 0,1,2,3
Val
Validate YOLOv5m-seg accuracy on ImageNet-1k dataset:
bash data/scripts/get_coco.sh --val --segments # download COCO val segments split (780MB, 5000 images)
python segment/val.py --weights yolov5s-seg.pt --data coco.yaml --img 640 # validate
Predict
Use pretrained YOLOv5m-seg to predict bus.jpg:
python segment/predict.py --weights yolov5m-seg.pt --data data/images/bus.jpg
model = torch.hub.load('ultralytics/yolov5', 'custom', 'yolov5m-seg.pt') # load from PyTorch Hub (WARNING: inference not yet supported)
Export YOLOv5s-seg model to ONNX and TensorRT:
python export.py --weights yolov5s-seg.pt --include onnx engine --img 640 --device 0
Changelog
- Changes between previous release and this release: https://github.com/ultralytics/yolov5/compare/v6.2...v7.0
- Changes since this release: https://github.com/ultralytics/yolov5/compare/v7.0...HEAD
Files
ultralytics/yolov5-v7.0.zip
Files
(1.0 MB)
Name | Size | Download all |
---|---|---|
md5:6d68e041397b09a1c05f927b068321ee
|
1.0 MB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/ultralytics/yolov5/tree/v7.0 (URL)