ultralytics/yolov5

Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.

What is YOLOv5?

YOLOv5 is an open‑source computer‑vision model from Ultralytics built on PyTorch. It provides fast, accurate object detection, instance segmentation, and image classification. The repo contains the model code, pretrained checkpoints, training scripts, and utilities for inference, export, and deployment.

Key Capabilities

  • Inference via a simple Python API (torch.hub.load) or the ready‑made detect.py script.
  • Training on custom data or the COCO dataset with a single command (python train.py).
  • Model sizes ranging from tiny (yolov5n) to large (yolov5x) to trade‑off speed vs. accuracy.
  • Export to ONNX, TensorRT, CoreML, TFLite, etc., for edge deployment.
  • Integrations with W&B, Comet, Roboflow, OpenVINO, ClearML, DeepSparse, and the Ultralytics Platform for experiment tracking and production pipelines.
  • Additional tasks (via the newer ultralytics package) such as pose estimation and oriented‑bbox detection.

Quick Start

# Clone and install
git clone https://github.com/ultralytics/yolov5 && cd yolov5
pip install -r requirements.txt   # Python ≥3.8, PyTorch ≥1.8

# Run inference (any image source)
python detect.py --weights yolov5s.pt --source img.jpg

# Train on COCO (example)
python train.py --data coco.yaml --epochs 300 --weights '' \
    --cfg yolov5s.yaml --batch-size 64

Or use the PyTorch‑Hub shortcut:

import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
results = model('https://ultralytics.com/images/zidane.jpg')
results.show()

Pre‑trained Models & Performance

Model mAP@0.5‑0.95 Params (M) V100 b1 latency (ms)
yolov5n 28.0 1.9 6.3
yolov5s 37.4 7.2 6.4
yolov5m 45.4 21.2 8.2
yolov5l 49.0 46.5 10.1
yolov5x 50.7 86.7 12.1

The table (from the README) shows the trade‑off between size, accuracy, and speed.

Documentation & Resources

  • Full docs: https://docs.ultralytics.com/yolov5
  • Tutorials: training custom data, multi‑GPU training, model export, TTA, ensembling, pruning, hyper‑parameter evolution, etc.
  • Community: Discord, Forums, Reddit, and a Docker image (ultralytics/yolov5).
  • Enterprise licensing is available for commercial use.

Who Might Use It?

  • Researchers needing a baseline detector that is easy to modify.
  • Developers building real‑time vision applications (e.g., surveillance, robotics, drones).
  • Teams that want a ready‑to‑deploy model with export pipelines for edge devices.

All information above is taken directly from the repository’s README; no additional features have been inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Project