# Ultralytics YOLO

> Train and run YOLO models for real-time detection, segmentation, and tracking

- Category: Multimodal Generation / Vision & Understanding
- Language: Python
- Licence: AGPL-3.0
- Repository: https://github.com/ultralytics/ultralytics
- Website: https://docs.ultralytics.com
- Canonical page: https://ai-tldr.dev/tools/ultralytics-yolo/

## In short

Ultralytics YOLO is a Python framework for training and running YOLO models on common computer vision tasks. It covers object detection, tracking, instance and semantic segmentation, image classification, and pose estimation behind one consistent API. It sits in the Vision & Understanding category of the Multimodal Generation tools and is open-source, written in Python and licensed AGPL-3.0.

## Overview

Ultralytics YOLO is a Python framework for training and running YOLO models on common computer vision tasks. It covers object detection, tracking, instance and semantic segmentation, image classification, and pose estimation behind one consistent API.

It is aimed at developers and researchers who want to fine-tune a vision model on their own data or run a pretrained model on images and video. You work with it either from the command line using the yolo command or directly in Python with the YOLO class.

Within the computer vision category, it sits at the model-training and inference layer: you load a pretrained checkpoint, train or validate it on a dataset, run predictions, and export the result to formats like ONNX for deployment.

## What it does

- One API across detection, tracking, segmentation, classification, and pose estimation tasks
- Command-line yolo tool and a Python YOLO class for the same workflows
- Train, validate, predict, and export modes built in
- Ships with pretrained checkpoints you can fine-tune on your own datasets
- Export trained models to formats such as ONNX for deployment
- Runs on Python 3.8+ with PyTorch 1.8+

## Getting started

Install the package into a Python 3.8+ environment with PyTorch 1.8+, then run a prediction from the CLI or train and export a model in Python.

1. Install the package

   Install ultralytics and its requirements with pip.

```bash
pip install ultralytics
```

2. Run a prediction from the CLI

   Use the yolo command to predict on an image with a pretrained model.

```bash
yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
```

3. Train, evaluate, and export in Python

   Load a pretrained model, train it on a dataset, run inference, and export to ONNX.

```python
from ultralytics import YOLO

# Load a pretrained YOLO26n model
model = YOLO("yolo26n.pt")

# Train the model on the COCO8 dataset for 100 epochs
train_results = model.train(
    data="coco8.yaml",
    epochs=100,
    imgsz=640,
    device="cpu",
)

# Evaluate the model's performance on the validation set
metrics = model.val()

# Perform object detection on an image
results = model("path/to/image.jpg")
results[0].show()

# Export the model to ONNX format for deployment
path = model.export(format="onnx")
```

## When to use it

- Detecting and counting objects in images or video streams in real time
- Fine-tuning a pretrained detector on a custom labeled dataset
- Adding object tracking across frames in a video pipeline
- Exporting a trained model to ONNX to deploy it outside Python
