A PyTorch library implementing class activation map (CAM) methods to visualize which image regions drive a computer vision model's predictions.
ultralytics/yolov5
Ultralytics YOLOv5, a PyTorch-based computer vision toolkit for object detection, instance segmentation and image classification with training and export.
- Stars
- 58,185
- Forks
- 17,457
- Open issues
- 25
- Last commit
- 2 days ago
What is it?
YOLOv5 is a computer vision model library built on PyTorch by Ultralytics. It covers object detection, instance segmentation and image classification, with scripts for training on custom datasets, validating accuracy, running inference on images, videos, webcams and streams, and exporting trained weights.
The repository provides pretrained checkpoints in nano to extra-large sizes, trained on COCO and ImageNet, which can be loaded through PyTorch Hub or the detect.py command-line script. Training supports multi-GPU distributed data parallel runs, and the export tooling converts models to ONNX, TensorRT, CoreML and TFLite formats.
The project also documents tutorials for transfer learning, hyperparameter evolution, model pruning, test-time augmentation and logging integrations with tools such as ClearML, Comet and Weights & Biases. The repository notes that the actively maintained successor is the ultralytics pip package, which covers newer YOLO models and additional tasks such as pose estimation and oriented bounding boxes.
Key features
- 01Object detection, instance segmentation and image classification in one codebase.
- 02Pretrained checkpoints from nano to extra-large sizes, usable through PyTorch Hub or detect.py.
- 03Inference on images, videos, webcams, screen capture, RTSP streams and YouTube URLs.
- 04Training with multi-GPU DDP and AutoBatch batch-size selection.
- 05Export to ONNX, TensorRT, CoreML and TFLite formats.
Use cases
- Training a detector on a custom labeled dataset.
- Running real-time object detection on a webcam or video file.
- Deploying a trained model to edge devices through TensorRT or TFLite.
- Experimenting with segmentation or classification using pretrained checkpoints.
Quick start
- 1
Clone the repository
git clone https://github.com/ultralytics/yolov5 - 2
Enter the cloned directory
cd yolov5 - 3
Install required packages
pip install -r requirements.txt - 4
Run inference on a local image
python detect.py --weights yolov5s.pt --source img.jpg
Things to know
- Licensed under AGPL-3.0, which is copyleft and may require open-sourcing derivative network services.
- Enterprise use without AGPL obligations requires a separate license from Ultralytics.
- The README notes that the actively maintained ultralytics package is recommended for newer architectures.
Topics
FAQ
- What is yolov5?
- Ultralytics YOLOv5, a PyTorch-based computer vision toolkit for object detection, instance segmentation and image classification with training and export. YOLOv5 is a computer vision model library built on PyTorch by Ultralytics. It covers object detection, instance segmentation and image classification, with scripts for training on custom datasets, validating accuracy, running inference on images, videos, webcams and streams, and exporting trained weights.
- Is yolov5 free to use? What license does it have?
- yolov5 is open source under the AGPL-3.0 license. Check the license terms before using it in commercial products.
- Is yolov5 still maintained?
- Actively maintained. The last commit to yolov5 was on Oct 18, 2026.
- What can I use yolov5 for?
- Training a detector on a custom labeled dataset. Running real-time object detection on a webcam or video file. Deploying a trained model to edge devices through TensorRT or TFLite. Experimenting with segmentation or classification using pretrained checkpoints.
- How do I install yolov5?
- Clone the repository: git clone https://github.com/ultralytics/yolov5 Enter the cloned directory: cd yolov5 Install required packages: pip install -r requirements.txt Run inference on a local image: python detect.py --weights yolov5s.pt --source img.jpg
- Where can I get yolov5?
- The source code and installation instructions are on GitHub: https://github.com/ultralytics/yolov5
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A cross-platform desktop app for AI-assisted annotation of text, image, video, point cloud and multimodal data, with built-in models and multi-format export.
Official PyTorch implementation of BiRefNet, a deep learning model for high-resolution dichotomous image segmentation, commonly used for background removal.
A collection of 419 pre-trained AI models covering vision, speech, NLP and LLMs, all runnable from a shared Python CLI via the ailia SDK.
A deep learning optimization library for making distributed training and inference of large models easier and more efficient.
Python tool for blind face restoration, enhancing blurry, low-quality or damaged faces in photos and videos using a codebook lookup transformer.