Skip to main content

Ultralytics Python API Reference

This section is the complete Python API reference for the ultralytics package. Every page is auto-generated directly from the source so it always stays in sync with the latest release. Use it to look up classes, functions, and method signatures while building with Ultralytics YOLO.

If you're new to Ultralytics, the Quickstart, Modes, and Tasks guides are the best place to start. Once you're writing code, come back here for the exact API details.

Sections

  • __init__: Top-level package entry point with lazy imports for YOLO, NAS, RTDETR, SAM, FastSAM, YOLOE, and related model classes.
  • cfg: Default configuration loading, CLI argument parsing, and the global DEFAULT_CFG used across training, validation, prediction, and export.
  • data: Dataset classes, data loaders, augmentations, and format converters for detection, segmentation, classification, pose, OBB, and tracking.
  • engine: Core training, validation, prediction, export, and tuning engine — the backbone of the Model, Trainer, Validator, Predictor, Exporter, and Tuner interfaces.
  • hub: Ultralytics HUB integration for authentication, sessions, dataset uploads, and cloud-based training.
  • models: Model implementations for YOLO, YOLOE, YOLO-World, SAM, SAM3, FastSAM, RT-DETR, and YOLO-NAS, including their predict, train, val, and export pipelines.
  • nn: Neural network building blocks — backbones, necks, heads, layers, and the multi-backend AutoBackend runtime (PyTorch, ONNX, TensorRT, CoreML, OpenVINO, TFLite, and more).
  • optim: Custom optimizers, including the Muon optimizer used for advanced training experiments.
  • solutions: Ready-made Ultralytics Solutions — object counting, heatmaps, AI Gym, parking management, region counting, similarity search, and more.
  • trackers: Multi-object trackers (BYTETracker, BoTSORT) and the unified tracking API that plugs them into any YOLO model.
  • utils: Cross-cutting utilities — logging, metrics, plotting, ops, downloads, checks, callbacks, and integrations with Weights & Biases, MLflow, Comet, and other tools.

How this reference is generated

These pages are produced automatically by docs/build_reference.py, which walks the ultralytics package, parses each Python module, and renders the docstrings with mkdocstrings. The best way to improve a page is to improve the docstring in the corresponding source file — open a Pull Request and the docs will update on the next build. 🙏

Looking for something else?

Comments