ultralytics /yolov5
Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.
★ 58,272⑂ 17,434👁 379⑃ 3,071● 9,428▤ 10
More from this author
+5
Daily
+17
Weekly
+92
Monthly
58,272
stars
17,434
forks
379
watchers
3,071
prs
9,428
issues
10
releases
README
中文 | 한국어 | 日本語 | Русский | Deutsch | Français | Español | Português | Türkçe | Tiếng Việt | العربية
Ultralytics YOLOv5 🚀 is a fast, accurate, and easy-to-use computer vision model developed by Ultralytics. Based on the PyTorch framework, YOLOv5 is renowned for its speed, accuracy, and simplicity. It incorporates insights and best practices from extensive research and development, making it a popular and reliable choice for a wide range of vision AI tasks, including object detection, image segmentation, and image classification.
We hope the resources here help you get the most out of YOLOv5. Please browse the YOLOv5 Docs for detailed information, raise an issue on GitHub for support, and join our Discord community for questions and discussions!
To request an Enterprise License, please complete the form at Ultralytics Licensing.
🚀 Explore the Ultralytics YOLO Ecosystem
YOLOv5 is a mature, production-proven model that remains an excellent choice for fast and reliable object detection, instance segmentation, and image classification. If your project calls for the newest architectures, additional tasks such as pose estimation and oriented object detection (OBB), or a unified Python and CLI interface, the actively maintained ultralytics package brings the latest Ultralytics YOLO models together in one place. Explore the Ultralytics Docs to find the best fit for your use case.
bash
Install the ultralytics package for the latest Ultralytics YOLO models
pip install ultralytics
📚 Documentation
See the YOLOv5 Docs for full documentation on training, testing, and deployment. See below for quickstart examples.
Install
Clone the repository and install dependencies in a Python=3.8.0 environment. Ensure you have PyTorch=1.8 installed.
bash
Clone the YOLOv5 repository
git clone https://github.com/ultralytics/yolov5
Navigate to the cloned directory
cd yolov5
Install required packages
pip install -r requirements.txt
Inference with PyTorch Hub
Use YOLOv5 via PyTorch Hub for inference. Models are automatically downloaded from the latest YOLOv5 release.
python
import torch
Load a YOLOv5 model (options: yolov5n, yolov5s, yolov5m, yolov5l, yolov5x)
model = torch.hub.load("ultralytics/yolov5", "yolov5s") Default: yolov5s
Define the input image source (URL, local file, PIL image, OpenCV frame, numpy array, or list)
img = "https://ultralytics.com/images/zidane.jpg" Example image
Perform inference (handles batching, resizing, normalization automatically)
results = model(img)
Process the results (options: .print(), .show(), .save(), .crop(), .pandas())
results.print() Print results to console
results.show() Display results in a window
results.save() Save results to runs/detect/exp
Inference with detect.py
The detect.py script runs inference on various sources. It automatically downloads models from the latest YOLOv5 release anTop issues
#251TFLite, ONNX, CoreML, TensorRT Export407 comments · 2020-06-30#36Load YOLOv5 from PyTorch Hub ⭐320 comments · 2020-06-11#12Train Custom Data Tutorial ⭐214 comments · 2020-06-03#607Hyperparameter Evolution204 comments · 2020-08-02#475Multi-GPU Training 🌟111 comments · 2020-07-22#318Model Ensembling Tutorial108 comments · 2020-07-07#9627NVIDIA Jetson Nvidia Jetson Nano, Xavier NX, Orin Deployment tutorial78 comments · 2022-09-28#6998YOLOv5 (6.0/6.1) brief summary65 comments · 2022-03-16
Discussions
#13863Create custom dataset from pre-existing datasets2 comments · 2026-08-17#13722cv2.cuda_GpuMat()0 comments · 2026-03-16#13639Synthetic YOLO Dataset Generator0 comments · 2025-08-03#13636CUDNN ERROR in Blackwell GPU0 comments · 2025-07-30#13569Generating Precision, Recall, and [email protected] Metrics for Each Category in Faster R-CNN Using Detectron2 Object Detection Models0 comments · 2025-04-20#13557Problem with incorporating Python in visual studio code to employ YOLOv5 and practice object detection1 comments · 2025-04-08#13538How can I add more hyperparameters in YOLOv5 Genetic algorithm to evolve them?0 comments · 2025-03-20#13518font and color of the annotation box1 comments · 2025-02-24
Latest release
v7.0 - YOLOv5 SOTA Realtime Instance Segmentation v7.0 2022-11-22[assets]: https://github.com/ultralytics/yolov5/releases [previous]: https://github.com/ultralytics/yolov5/releases/tag/v6.2 [current]: https://github.com/ultralytics/yolov5/releases/tag/v7.0 [TTA]: https://github.com/ultralytics/yolov5/issues/303 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. Our primary