YOLOX

YOLOX is an anchor-free, single-stage detector with a decoupled classification-regression head, trained with SimOTA label assignment. LibreYOLO supports it for detection.

Tasks
detection
Sizes
n, t, s, m, l, x at 416 to 640 px
Install
pip install libreyolo
Support tier
Supported, since v. Supporting trainables: kept green in CI, features land opportunistically.
Upstream
YOLOX by Megvii, Apache-2.0. Paper, source
Licenses
Code Apache-2.0, weights Apache-2.0. Commercial use

Install

YOLOX 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("LibreYOLOXs.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes:    print(box.cls, box.conf, box.xyxy)
CLI
libreyolo predict model=LibreYOLOXs.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True

The returned Results object is the one every family returns, so swapping in a different detector is a one line change. conf sets the confidence threshold and iou the NMS threshold applied across the three decoupled prediction scales. See prediction for sources, streaming and result handling.

Variants

Six sizes share the same CSP backbone and PAFPN neck. The two smallest, n and t, run at a smaller fixed input resolution than the other four; the benchmark table below carries the exact figure for each.

CheckpointInput (px)mAP 50-95Params (M)
LibreYOLOXnano41628.80.91
LibreYOLOXtiny41635.15.06
LibreYOLOXl64053.954.21
LibreYOLOXm64050.925.33
LibreYOLOXs64043.08.97
LibreYOLOXx64056.399.07

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("LibreYOLOXs.pt")model.train(data="my-dataset.yaml", epochs=300, imgsz=640, batch=16, lr0=0.01)
CLI
libreyolo train model=LibreYOLOXs.pt data=my-dataset.yaml \  epochs=300 imgsz=640 batch=16 lr0=0.01

Left alone, the trainer runs 300 epochs at lr0=0.01 with SGD momentum 0.9, a 5-epoch warmup and mosaic and mixup augmentation switched off for the final 15 epochs. train() also accepts a pretrained argument, but the value is never read inside the method: training always continues from whatever weights the model was constructed with, so pretrained=False does not reinitialize the network.

imgsz defaults to a fixed value in the base training config, not to the loaded checkpoint's native resolution. That affects the n and t checkpoints specifically: continuing to train either one without setting imgsz explicitly switches it up to the larger default rather than the smaller size it was published at.

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("LibreYOLOXs.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])
CLI
libreyolo val model=LibreYOLOXs.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=LibreYOLOXn.pt data=coco.yaml imgsz=416 \  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: not supportedDetection to MNN: not supportedDetection to RKNN: not supportedDetection to ncnn: supported. Detection to TFLite: supported. Detection to CoreML: supported. Detection to Core AI: supported.

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. A CoreML export can bake NMS into the graph with nms=True; YOLOX and YOLOv9 are the only two families that flag currently accepts.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLOXs.pt")model.export(format="onnx", imgsz=640)model.export(format="tensorrt", imgsz=640, half=True)
CLI
libreyolo export model=LibreYOLOXs.pt format=onnx imgsz=640libreyolo export model=LibreYOLOXs.pt format=tensorrt imgsz=640 half=True
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("LibreYOLOXs.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)

Checkpoints

Every published weight file for this family.

FileInput (px)Weights license
Detection
LibreYOLOXn.pt416apache-2.0
LibreYOLOXt.pt416apache-2.0
LibreYOLOXs.pt640apache-2.0
LibreYOLOXm.pt640apache-2.0
LibreYOLOXl.pt640apache-2.0
LibreYOLOXx.pt640apache-2.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
YOLOX, Megvii
Upstream license
Apache-2.0
LibreYOLO code
MIT
Weights
Apache-2.0, republished at huggingface.co/LibreYOLO
Interpretation
Apache-2.0 is a permissive license, so these weights can be used in commercial and closed-source products. It asks you to keep its license text and attribution notices with any copy of the weights you redistribute, and it grants a patent license. It places no obligation on your own application code, and weights you train yourself on your own data are yours.

Citation

@article{yolox2021,
  title={YOLOX: Exceeding YOLO Series in 2021},
  author={Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
  journal={arXiv preprint arXiv:2107.08430},
  year={2021}
}

Copied from the authors' citation block at github.com/Megvii-BaseDetection/YOLOX#cite-yolox.

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.