Yolov5
Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.
Install / Use
npx skills add ultralytics/yolov5Installs into whichever agent you are using.
README
中文 | 한국어 | 日本語 | Русский | Deutsch | Français | Español | Português | Türkçe | Tiếng Việt | العربية
<div> <a href="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml"><img src="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml/badge.svg" alt="YOLOv5 CI Testing"></a> <a href="https://hub.docker.com/r/ultralytics/yolov5"><img src="https://img.shields.io/docker/pulls/ultralytics/yolov5?logo=docker" alt="Docker Pulls"></a> <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://www.reddit.com/r/ultralytics/"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a> <br> <a href="https://console.paperspace.com/github/ultralytics/yolov5"><img src="https://img.shields.io/badge/Run%20on-Gradient-0A0A0A" alt="Run on Gradient"></a> <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> <a href="https://www.kaggle.com/models/ultralytics/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a> </div> <br>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.
<div align="center"> <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="2%" alt="Ultralytics GitHub"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="2%" alt="Ultralytics LinkedIn"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="2%" alt="Ultralytics Twitter"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://www.youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="2%" alt="Ultralytics YouTube"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="2%" alt="Ultralytics TikTok"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="2%" alt="Ultralytics BiliBili"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space"> <a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="2%" alt="Ultralytics Discord"></a> </div> </div> <br>🚀 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.
# Install the ultralytics package for the latest Ultralytics YOLO models
pip install ultralytics
<div align="center">
<a href="https://docs.ultralytics.com/models" target="_blank">
<img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/refs/heads/main/yolo/performance-comparison.png" alt="Ultralytics YOLO performance comparison"></a>
</div>
📚 Documentation
See the YOLOv5 Docs for full documentation on training, testing, and deployment. See below for quickstart examples.
<details open> <summary>Install</summary>Clone the repository and install dependencies in a Python>=3.8.0 environment. Ensure you have PyTorch>=1.8 installed.
# 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
</details>
<details open>
<summary>Inference with PyTorch Hub</summary>
Use YOLOv5 via PyTorch Hub for inference. Models are automatically downloaded from the latest YOLOv5 release.
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
</details>
<details>
<summary>Inference with detect.py</summary>
The detect.py script runs inference on various sources. It automatically downloads models from the latest YOLOv5 release and saves the results to the runs/detect directory.
# Run inference using a webcam
python detect.py --weights yolov5s.pt --source 0
# Run inference on a local image file
python detect.py --weights yolov5s.pt --source img.jpg
# Run inference on a local video file
python detect.py --weights yolov5s.pt --source vid.mp4
# Run inference on a screen capture
python detect.py --weights yolov5s.pt --source screen
# Run inference on a directory of images
python detect.py --weights yolov5s.pt --source path/to/images/
# Run inference on a text file listing image paths
python detect.py --weights yolov5s.pt --source list.txt
# Run inference on a text file listing stream URLs
python detect.py --weights yolov5s.pt --source list.streams
# Run inference using a glob pattern for images
python detect.py --weights yolov5s.pt --source 'path/to/*.jpg'
# Run inference on a YouTube video URL
python detect.py --weights yolov5s.pt --source 'https://youtu.be/LNwODJXcvt4'
# Run inference on an RTSP, RTMP, or HTTP stream
python detect.py --weights yolov5s.pt --source 'rtsp://example.com/media.mp4'
</details>
<details>
<summary>Training</summary>
The commands below demonstrate how to reproduce YOLOv5 COCO dataset results. Both [models](http
Related Skills
mcp
Use the `mcp_perplexity-ask_perplexity_search` tools to answer questions. You should use this instead of the `web_search` tool because it is a lot more accurate.
practical-power-systems-synthesis
This skill enables synthesis in the domain of power-systems (engineering). It represents research-level-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform synthesis operations related to power-systems.
semi-supervised-optogenetics-testing
This skill enables testing in the domain of optogenetics (neuroscience). It represents intermediate-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform testing operations related to optogenetics.
data-mining-interpretation-fundamental
This skill enables interpretation in the domain of data-mining (data-science). It represents fundamental-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform interpretation operations related to data-mining.
