File size: 3,180 Bytes
26fe469
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
library_name: onnx
tags:
  - yolox
  - object-detection
  - coco
  - computer-vision
  - apache-2.0
  - onnx
  - inference4j
license: apache-2.0
pipeline_tag: object-detection
---

# YOLOX-Tiny — ONNX

The official ONNX export of YOLOX-Tiny from Megvii's [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) 0.1.1rc0 release, an anchor-free YOLO detector trained on COCO (80 classes). Apache-2.0 code and weights, a permissive alternative to AGPL-licensed YOLOv8 and YOLO26.

Mirrored for use with [inference4j](https://github.com/inference4j/inference4j), an inference-only AI library for Java.

## Original Source

- **Repository:** [Megvii (YOLOX)](https://github.com/Megvii-BaseDetection/YOLOX)
- **License:** apache-2.0

## Usage with inference4j

```java
try (ObjectDetector detector = YoloXDetector.tiny().build()) {
    List<Detection> detections = detector.detect(Path.of("street.jpg"));
    detections.forEach(d -> System.out.printf("%s (%.0f%%) at [%.0f, %.0f, %.0f, %.0f]%n",
        d.label(), d.confidence() * 100,
        d.box().x1(), d.box().y1(), d.box().x2(), d.box().y2()));
}
```

## Model Details

| Property | Value |
|----------|-------|
| Architecture | YOLOX-Tiny (anchor-free, decoupled head), 5.06M parameters |
| Task | Object detection (COCO 80 classes) |
| COCO AP | 32.8 (val2017, 416x416, as reported by the YOLOX authors) |
| Input | `images`: `[1, 3, 416, 416]` float32, static |
| Pre-processing | Letterbox to the top-left corner: scale `r = min(416 / h, 416 / w)`, bilinear resize to `(int(w * r), int(h * r))`, pad right and bottom with 114. Raw 0-255 **BGR**, no mean/std, NCHW float32 |
| Output | `output`: `[1, 3549, 85]`: per anchor point `[x, y, w, h, objectness, 80 class scores]`, box not yet decoded |
| Post-processing | Decode per anchor point over strides 8, 16, 32 (row-major grid, stride 8 first): `cx = (x + grid_x) * stride`, `cy = (y + grid_y) * stride`, `w = exp(w) * stride`, `h = exp(h) * stride`. Score = objectness × class score (both already sigmoid), take the best class, divide boxes by `r`. NMS is not in the graph: the reference demo uses class-agnostic NMS at IoU 0.45 |
| Labels | COCO-80 in the usual order (0 = person ... 79 = toothbrush) |
| Original framework | PyTorch 1.7, ONNX opset 11 |

## License

This model is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Original model by [Megvii](https://github.com/Megvii-BaseDetection/YOLOX) (Ge et al., *YOLOX: Exceeding YOLO Series in 2021*, arXiv:2107.08430).

## Provenance

| Part | Origin |
|------|--------|
| Code | [Megvii-BaseDetection/YOLOX](https://github.com/Megvii-BaseDetection/YOLOX), Apache-2.0 |
| Weights | [yolox_tiny.pth](https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_tiny.pth), YOLOX 0.1.1rc0 release, Apache-2.0 |
| ONNX export | [yolox_tiny.onnx](https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_tiny.onnx), the official export from the same release |
| Training data | COCO 2017 train (80 classes), trained from scratch: the YOLOX paper drops ImageNet pre-training |
| Changes in this mirror | None: files copied unchanged |