YOLOv9

A single-stage convolutional detector: one pass scores a dense grid of boxes and NMS drops the duplicates. LibreYOLO carries three variants of it, one of which has no NMS step.

Tasks
detection
Sizes
yolo9: t, s, m, c at 640 px; yolo9_p2: t, s at 640 px
Install
pip install libreyolo
Support tier
Flagship, since v1.0.0. Features are designed and fully GPU-validated here first.
Upstream
YOLOv9 by MultimediaTechLab, MIT. Paper, source
Licenses
Code MIT, weights MIT. Commercial use

Install

YOLOv9 needs no extra beyond the base package.

bash
pip install libreyolo

Predict

Weights download from Hugging Face on first use and are cached locally.

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreYOLO9s.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes:    print(box.cls, box.conf, box.xyxy)
CLI
libreyolo predict model=LibreYOLO9s.pt save=True \  source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg
Without NMS
from libreyolo import LibreYOLO, SAMPLE_IMAGE # Same call, different checkpoint. The end-to-end head returns its own# top-scoring predictions, so no NMS runs and iou is ignored.model = LibreYOLO("LibreYOLO9E2Es.pt")result = model(SAMPLE_IMAGE, conf=0.25, max_det=300) print(len(result.boxes))

The returned Results object is the one every family returns, so swapping in a different detector is a one line change. On the base and stride-4 models, conf sets the confidence threshold and iou the NMS threshold. The end-to-end model runs no NMS and ignores iou, so conf and max_det are what shape its output. See prediction for sources, streaming and result handling.

Variants

Three variants share a backbone. All three detect only, and they take the same arguments.

The base model predicts on three feature scales and clears duplicate boxes with NMS.

The end-to-end model keeps that head and adds a one-to-one matching branch beside it. Inference reads the one-to-one branch alone and takes its top-scoring predictions, so no NMS runs. Choose it when the runtime you deploy to has no NMS operator.

The stride-4 model surfaces one level further up the backbone, extends the neck down to it and predicts on four scales instead of three. The extra scale is for objects that cover few pixels; the one published checkpoint for it is trained on aerial imagery. Base detection checkpoints transfer into it: the backbone and neck load unchanged, the three pretrained head towers shift up one slot, and the stride-4 tower starts from random initialization.

CheckpointInput (px)mAP 50-95Params (M)
LibreYOLO9c64056.425.5
LibreYOLO9m64055.320.12
LibreYOLO9s64055.97.2
LibreYOLO9t64054.02.02

COCO val2017, 500 images. Measured by the LibreYOLO benchmark harness and published on Vision Analysis, where latency across hardware and runtimes is compared and the full run records live.

Train

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLO9s.pt")model.train(data="my-dataset.yaml", epochs=100, imgsz=640, batch=16)
CLI
libreyolo train model=LibreYOLO9s.pt data=my-dataset.yaml \  epochs=100 imgsz=640 batch=16
Small objects
from libreyolo import LibreYOLO9P2 # The stride-4 variant has no COCO checkpoint of its own, so name a# base detection one: its backbone and neck load unchanged and the# stride-4 head tower starts from random initialization.model = LibreYOLO9P2(None, size="s")model.train(data="my-dataset.yaml", epochs=100, pretrained="LibreYOLO9s.pt")

pretrained decides what the run starts from. Pass True to load the published checkpoint for the same model and size, or a name or path for anything else. Tensors whose shape does not match are skipped rather than refused, and the run logs how many loaded, so a checkpoint trained on a different class count is still a usable starting point.

The stride-4 model has no published COCO checkpoint of its own, so True resolves there to a file that does not exist and the download fails. Name a base detection checkpoint instead.

See training for datasets, augmentation, multi-GPU and loggers.

Validate

val() returns a dictionary of metrics/ keys covering precision, recall, mAP 50 and mAP 50-95, measured against any dataset in the format you trained on.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLO9s.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])
CLI
libreyolo val model=LibreYOLO9s.pt data=my-dataset.yaml
Against COCO
# The bundled COCO yaml carries an embedded download script, so it# needs explicit permission unless the dataset is already local.libreyolo val model=LibreYOLO9c.pt data=coco.yaml imgsz=640 \  allow_download_scripts=True

Export

TaskONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: supported. Detection to TorchScript: supported. Detection to ExecuTorch: supported. Detection to TensorRT: supported. Detection to OpenVINO: supported. Detection to Paddle: supported. Detection to MNN: supported. Detection to RKNN: not supportedDetection to ncnn: supported. Detection to TFLite: not supportedDetection to CoreML: not supportedDetection to Core AI: supported.

A tick holds for all three variants: where they differ, the matrix carries the weakest of the three.

An exported artifact loads back through LibreYOLO() on its file suffix, so a .onnx or .engine file behaves like a checkpoint and returns the same Results. Running the graph in a bare runtime, with no LibreYOLO installed, is also supported, but then preprocessing and postprocessing are yours to write.

For the base detection model, the postprocessing half of that can move into the graph. nms=True on an ONNX export puts suppression inside the model, and the first output becomes a fixed (1, max_det, 6) tensor whose rows are x1, y1, x2, y2, score, class, zero-padded past the detection count. That graph is batch 1 and carries no dynamic axes. The end-to-end and stride-4 models do not accept the flag.

Each format installs a different extra and takes a few arguments of its own. Both are on that format's page.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLO9s.pt")model.export(format="onnx", imgsz=640)
CLI
libreyolo export model=LibreYOLO9s.pt format=onnx imgsz=640
With NMS in the graph
libreyolo export model=LibreYOLO9s.pt format=onnx nms=True \  conf=0.25 iou=0.45 max_det=300
Use the exported file
from libreyolo import LibreYOLO, SAMPLE_IMAGE # The factory routes on the file suffix, so an exported artifact loads# like any checkpoint and returns the same Results object.model = LibreYOLO("LibreYOLO9s.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)

Checkpoints

Every published weight file for this family.

FileInput (px)Weights license
Detection
LibreYOLO9t.pt640mit
LibreYOLO9s.pt640mit
LibreYOLO9m.pt640mit
LibreYOLO9c.pt640mit
LibreYOLO9E2Et.pt640mit
LibreYOLO9E2Es.pt640mit
LibreYOLO9E2Em.pt640mit
LibreYOLO9E2Ec.pt640mit
LibreYOLO9P2s-visdrone.ptcc-by-nc-sa-3.0

Every file above exists in the LibreYOLO org today and downloads on first use.

Licensing

Check the license on the Hugging Face repository of the specific weights you download. Every checkpoint in the LibreYOLO org carries one, and they are not always the same across a family. That repository is the authoritative source; the summary below describes what applied when this page was last verified.

This is a description of the licenses involved, not legal advice. If the answer matters commercially, read the licenses yourself and take your own counsel.

Original work
YOLOv9, MultimediaTechLab
Upstream license
MIT
LibreYOLO code
MIT
Weights
MIT, republished at huggingface.co/LibreYOLO
Interpretation
MIT is a permissive license, so these weights can be used in commercial and closed-source products. The one standing obligation is to keep the license text and the copyright notice, Kin-Yiu Wong and Hao-Tang Tsui, with any copy you redistribute. It places no condition on your own application code, and a model you train yourself on your own data is yours. Two things are worth knowing beyond that. The port follows the authors' MIT re-release of YOLOv9, not the GPL-3.0 repository that carries the same model, so the permissive terms come from the source LibreYOLO actually derives from. And one checkpoint in this family is not MIT: the stride-4 model trained on VisDrone2019-DET inherits that dataset's CC BY-NC-SA 3.0 terms, which rule out commercial use and require share-alike on anything derived from it.

One checkpoint here is not MIT. The stride-4 model trained on VisDrone2019-DET inherits that dataset's CC BY-NC-SA 3.0 terms: non-commercial use only, share-alike on anything derived from it, and outside the permissive license the rest of this family ships under. It predicts the VisDrone aerial classes rather than the COCO ones. The library prints all of this before it downloads the file.

Citation

@inproceedings{wang2024yolov9,
      title={{YOLOv9}: Learning What You Want to Learn Using Programmable Gradient Information},
      author={Wang, Chien-Yao and Yeh, I-Hau and Liao, Hong-Yuan Mark},
      year={2024},
      booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
}

Copied from the authors' citation block at github.com/MultimediaTechLab/YOLO#citations.

Verified against LibreYOLO v1.5.0. Support tables, checkpoints and benchmark numbers on this page are generated from the released library and the published weights, not written by hand.