YOLOX (tiny / S / M / L / X) (fastforks)

YOLOX (Ge et al. 2021, Megvii): anchor-free one-stage detector, all convolutions: a CSPDarknet backbone, a PAFPN neck and a decoupled head that predicts, per cell of the stride 8 / 16 / 32 maps, a box (centre and size), an objectness and a score per class; a cell's score is objectness x its best class; class-wise NMS. COCO checkpoints (80 classes) from the authors. The image is fitted into 640 x 640 (tiny: 416 x 416); vendored from the reference (no yolox dependency). The portable module() is the whole network (decoded boxes, scores and labels per cell, before NMS).

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/Megvii-BaseDetection/YOLOX at 6ddff4824372.

Task: detection. Tier: experimental. Outputs: boxes, scores, labels. Backends: portable, kernels.

Input: one RGB image. Output: boxes, class labels, scores and instance masks.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
yolox-l@1 yolox_l.pth 1e6b7fa62403 Apache-2.0 yes
yolox-m@1 yolox_m.pth 60076992b32d Apache-2.0 yes
yolox-s@1 yolox_s.pth f55ded7181e1 Apache-2.0 yes
yolox-tiny@1 yolox_tiny.pth 9de513de589a Apache-2.0 yes
yolox-x@1 yolox_x.pth 5652330b6ae8 Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

Training data: COCO 2017 (train, instance annotations) (COCO 2017 train, 300 epochs from scratch (no ImageNet pretraining; Ge et al. 2021, section 2.1)).

Licence evidence: https://github.com/Megvii-BaseDetection/YOLOX/blob/6ddff4824372906469a7fae2dc3206c7aa4bbaee/LICENSE (Apache-2.0); https://github.com/Megvii-BaseDetection/YOLOX/releases/tag/0.1.1rc0 (the weights)

Input size

any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): yolox-l 3000x4000 (0.6 GiB peak allocated, 0.6 reserved); yolox-m 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); yolox-s 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); yolox-tiny 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); yolox-x 3000x4000 (0.7 GiB peak allocated, 0.7 reserved)

Speed and memory

Detection, synthetic, 800x1344

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
yolox-l – 15.1 8.13 5.02 3.0x 1.6x 265 / 298 165 / 206 139 / 250
yolox-m – 12.4 6.42 3.45 3.6x 1.9x 142 / 160 110 / 132 77 / 184
yolox-s – 10.4 5.55 2.43 4.3x 2.3x 67 / 90 79 / 100 40 / 92
yolox-tiny – 9.79 5.58 1.80 5.4x 3.1x 32 / 58 60 / 92 22 / 88
yolox-x – 17.2 11.8 7.82 2.2x 1.5x 450 / 504 255 / 300 258 / 358

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
yolox-l 0.65 0.41 1.72 0.03 1.16 0.36
yolox-m 0.32 0.24 1.60 0.03 0.36 0.19
yolox-s 0.22 0.15 1.55 0.03 1.35 0.30
yolox-tiny 1.55 0.18 1.58 0.52 1.31 0.31
yolox-x 0.76 0.59 2.06 0.08 0.21 0.26

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
yolox-l 800x1344 8.13 ms 6.15 ms 3.10 ms 5.02 ms 15.3 s 21.2 s 165 / 206 173 / 208 139 / 250 279 / 324
yolox-m 800x1344 6.42 ms 3.70 ms 2.03 ms 3.45 ms 13.4 s 20.1 s 110 / 132 111 / 132 77 / 184 152 / 194
yolox-s 800x1344 5.55 ms 2.95 ms 1.02 ms 2.43 ms 12.7 s 17.2 s 79 / 100 74 / 96 40 / 92 86 / 126
yolox-tiny 800x1344 5.58 ms 2.87 ms 0.561 ms 1.80 ms 13.1 s 23.7 s 60 / 92 58 / 94 22 / 88 62 / 90
yolox-x 800x1344 11.8 ms 11.3 ms 5.28 ms 7.82 ms 15.8 s 24.1 s 255 / 300 265 / 296 258 / 358 432 / 478

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

pycocotools COCOeval of the top 100 detections per image. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
yolox-tiny COCO val2017, every 25th image (200), box mAP 38.16 38.20 38.21 38.29
yolox-s COCO val2017, every 25th image (200), box mAP 44.67 44.75 44.67 44.73
yolox-m COCO val2017, every 25th image (200), box mAP 50.34 50.28 50.29 50.38
yolox-l COCO val2017, every 25th image (200), box mAP 54.13 54.11 54.13 54.19
yolox-x COCO val2017, every 25th image (200), box mAP 54.64 54.61 54.64 54.60

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks db9e79d5, 2026-11-13.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.00037 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.2 and p99 <= 0.51 (absolute error of the output boxes).

Limitations

  • The image is resized like OpenCV 4's 8-bit INTER_LINEAR (what the reference calls); OpenCV 5 resizes differently by up to two grey levels, so a reference run on OpenCV 5 differs slightly.
  • Boxes are not clamped to the image, as upstream: at the right or bottom border they can reach a few pixels into the padding.
  • One label per box (the cell's best class), as upstream: a cell does not report a second class.

Usage

from fastforks import detection

model = detection.load("yolox-l")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.boxes, result.scores, result.labels  # [N, 4], [N], [N]
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: yolox-l, yolox-m, yolox-s, yolox-tiny, yolox-x.

Kernels backend

detection.load("yolox-l", mode="kernels") runs our CUDA kernels (cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/yolox