Instructions to use litert-community/yolox-tiny-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/yolox-tiny-litert with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: litert
|
| 4 |
+
pipeline_tag: object-detection
|
| 5 |
+
tags:
|
| 6 |
+
- object-detection
|
| 7 |
+
- yolox
|
| 8 |
+
- litert
|
| 9 |
+
- tflite
|
| 10 |
+
- on-device
|
| 11 |
+
- gpu
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# YOLOX-Tiny — LiteRT (CompiledModel GPU)
|
| 15 |
+
|
| 16 |
+
Megvii **YOLOX-Tiny** (COCO, Apache-2.0) re-authored to a **GPU-native** LiteRT `.tflite` via the
|
| 17 |
+
official **litert_torch** path (no onnx2tf). FP16, **10.4 MB**, input **416×416**.
|
| 18 |
+
|
| 19 |
+
Verified on a Pixel 8a: the whole graph runs on the GPU delegate (full **LITERT_CL residency**,
|
| 20 |
+
zero CPU fallback) and the GPU output matches the CPU/PyTorch reference (corr ≥ 0.999).
|
| 21 |
+
|
| 22 |
+
## Why this is GPU-clean
|
| 23 |
+
|
| 24 |
+
YOLOX is a pure CNN, but its **Focus stem** (stride-2 space-to-depth slicing) lowers to
|
| 25 |
+
`GATHER_ND`, which the GPU delegate rejects. Here the Focus + its following 3×3 conv are folded
|
| 26 |
+
into a single, numerically-exact **6×6 stride-2 conv**, so the graph has **zero GATHER/GATHER_ND/
|
| 27 |
+
TopK/Cast** ops and **no >4D tensors**. Activations (SiLU) lower to LOGISTIC+MUL.
|
| 28 |
+
|
| 29 |
+
## I/O
|
| 30 |
+
|
| 31 |
+
- **Input** `images` `[1, 416, 416, 3]` NHWC, **BGR, 0–255, no normalization** (YOLOX letterbox:
|
| 32 |
+
uniform-scale to fit, pad bottom/right with gray 114).
|
| 33 |
+
- **Output** `[1, 3549, 85]` raw heads, anchor-major. `85 = 4 box (cx,cy,w,h, grid units) + 1 obj
|
| 34 |
+
+ 80 class`. obj/class are already sigmoid'd; boxes are **not** decoded.
|
| 35 |
+
|
| 36 |
+
## Host-side decode (kept out of the graph for GPU-cleanliness)
|
| 37 |
+
|
| 38 |
+
For anchor `i` at grid `(gx,gy)` with `stride ∈ {8,16,32}`:
|
| 39 |
+
`cx=(raw_cx+gx)*stride`, `cy=(raw_cy+gy)*stride`, `w=exp(raw_w)*stride`, `h=exp(raw_h)*stride`;
|
| 40 |
+
`score = obj * max_class`; then per-class NMS. Divide boxes by the letterbox ratio to map back.
|
| 41 |
+
Reference Kotlin + Python decode in the sample below.
|
| 42 |
+
|
| 43 |
+
## Performance
|
| 44 |
+
|
| 45 |
+
COCO val2017 AP **32.8** (FP32 reference). Real-time on Pixel 8a GPU.
|
| 46 |
+
|
| 47 |
+
## Training data & PII
|
| 48 |
+
|
| 49 |
+
Trained by Megvii on **COCO 2017** (train2017), a public academic object-detection dataset
|
| 50 |
+
(Creative Commons). COCO images contain people as one of the 80 object categories; no names,
|
| 51 |
+
identities, or other personal attributes are modeled or output — the model emits only class id +
|
| 52 |
+
box. No additional or private data was used. Weights are the official Megvii release; only the op
|
| 53 |
+
graph was re-authored for GPU (weights unchanged).
|
| 54 |
+
|
| 55 |
+
## Sample app + conversion script
|
| 56 |
+
|
| 57 |
+
Android sample (CompiledModel GPU, Kotlin decode + NMS) and the `litert_torch` conversion script:
|
| 58 |
+
https://github.com/google-ai-edge/litert-samples (compiled_model_api/object_detection)
|