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
PythonAGPL-3.0Created 2020-05-18docs.ultralytics.com/yolov5/
More from this author
Download: v7.0 - YOLOv5 SOTA Realtime Instance Segmentationv7.0 ↓7.02022-11-22
+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 an

Top issues

Discussions

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 

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON