/ Модель

Характеристики

Размер весов
2,2 МБ
Лицензия
Apache 2.0
Библиотека
litert
Опубликована
27 июн 2026

yolox-nano-litert

Поиск объектовИзображение → bounding_boxes3 профессии

Компактная версия YOLOX-Nano в формате LiteRT для локальной детекции 80 классов объектов COCO на мобильных и встроенных устройствах.

1 704скачиваний за 30 дней2лайкавеса обновлены5 сен 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

YOLOX-Nano в формате LiteRT разработан сообществом litert-community на основе официальных весов Megvii для детекции объектов на устройствах. Модель представлена как FP16-файл TFLite размером 2,2 МБ и рассчитана на входные изображения 416×416; граф адаптирован для исполнения на GPU через LiteRT, при этом веса не изменены. В README заявлена точность COCO val2017 AP 25,8 для исходного FP32-эталона.

Модель принимает изображение в формате NHWC с каналами BGR и значениями 0–255 без нормализации; перед подачей требуется масштабирование с сохранением пропорций и дополнение до размера входа. Выход содержит сырые предсказания для 80 классов COCO: координаты рамок ещё нужно декодировать на стороне приложения и выполнить NMS. Применяется для локальной детекции объектов в мобильных и встроенных приложениях; README описывает исполнение на GPU LiteRT и приводит результаты также для отдельных GPU, NPU и CPU-конфигураций.

Лицензия — Apache-2.0. Ограничения: модель распознаёт набор классов COCO, а не произвольные категории; декодирование рамок и подавление дубликатов не входят в граф и должны быть реализованы приложением. Производительность зависит от устройства и выбранного runtime, а XNNPACK не обеспечивает пригодного CPU-исполнения указанного FP16-графа.

Сценарии применения

  • детекция объектов на изображениях с Android-камеры
  • локальное обнаружение объектов без отправки изображений в облако
  • подсчёт и локализация объектов из набора COCO
  • встраивание детекции объектов в приложения LiteRT на GPU
  • обнаружение людей и предметов на Raspberry Pi

Ограничения

Предсказывает только 80 классов COCO; декодирование сырых координат рамок и NMS необходимо выполнять вне модели. Результаты скорости зависят от устройства и runtime, а для указанного FP16-графа XNNPACK не обеспечивает пригодного исполнения на CPU.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

LiteRT is Google's on-device runtime, the new name for TensorFlow Lite (Android: com.google.ai.edge.litert:litert), and litert-torch, the renamed ai-edge-torch, is its PyTorch converter: a PyTorch model converted unmodified with litert_torch.convert matched the original to 4e-7 on a Galaxy S26 (measured, LiteRT 2.2.0, Android 16, 2026-09-05).

YOLOX-Nano — LiteRT (CompiledModel GPU)

YOLOX-Nano — on-device detections (Pixel 8a, LiteRT CompiledModel GPU)

Megvii YOLOX-Nano (COCO, Apache-2.0) re-authored to a GPU-native LiteRT .tflite via the official litert_torch path (no onnx2tf). FP16, 2.2 MB, input 416×416.

Verified on a Pixel 8a: the whole graph runs on the GPU delegate (full LITERT_CL residency, zero CPU fallback) and the GPU output matches the CPU/PyTorch reference (corr ≥ 0.999).

Why this is GPU-clean

YOLOX is a pure CNN, but its Focus stem (stride-2 space-to-depth slicing) lowers to GATHER_ND, which the GPU delegate rejects. Here the Focus + its following 3×3 conv are folded into a single, numerically-exact 6×6 stride-2 conv, so the graph has zero GATHER/GATHER_ND/ TopK/Cast ops and no >4D tensors. Activations (SiLU) lower to LOGISTIC+MUL.

I/O

  • Input images [1, 416, 416, 3] NHWC, BGR, 0–255, no normalization (YOLOX letterbox: uniform-scale to fit, pad bottom/right with gray 114).
  • Output [1, 3549, 85] raw heads, anchor-major. `85 = 4 box (cx,cy,w,h, grid units) + 1 obj
    • 80 class`. obj/class are already sigmoid'd; boxes are not decoded.

Host-side decode (kept out of the graph for GPU-cleanliness)

For anchor i at grid (gx,gy) with stride ∈ {8,16,32}: cx=(raw_cx+gx)*stride, cy=(raw_cy+gy)*stride, w=exp(raw_w)*stride, h=exp(raw_h)*stride; score = obj * max_class; then per-class NMS. Divide boxes by the letterbox ratio to map back. Reference Kotlin + Python decode in the sample below.

Minimal usage

Android (Kotlin, CompiledModel GPU)

val model = CompiledModel.create(context.assets, "yolox_nano.tflite",
    CompiledModel.Options(Accelerator.GPU), null)
val inputs = model.createInputBuffers()
val outputs = model.createOutputBuffers()
inputs[0].writeFloat(nhwc)             // [1,416,416,3] BGR 0-255, letterbox pad 114
model.run(inputs, outputs)
val raw = outputs[0].readFloat()       // [1,3549,85] -> decode + NMS on host (see Python)

Python (desktop verification)

import numpy as np
from PIL import Image
from ai_edge_litert.interpreter import Interpreter

SIZE = 416
img = Image.open("photo.jpg").convert("RGB")
r = min(SIZE / img.width, SIZE / img.height)
w, h = round(img.width * r), round(img.height * r)
canvas = np.full((SIZE, SIZE, 3), 114, np.float32)                # letterbox, gray 114
canvas[:h, :w] = np.asarray(img.resize((w, h)), np.float32)
x = np.ascontiguousarray(canvas[..., ::-1])[None]                 # RGB -> BGR, 0-255, NHWC

it = Interpreter(model_path="yolox_nano.tflite"); it.allocate_tensors()
it.set_tensor(it.get_input_details()[0]["index"], x); it.invoke()
out = it.get_tensor(it.get_output_details()[0]["index"])[0]       # [3549,85]

grids, strides = [], []                                           # anchors = grid cells, s 8/16/32
for s in (8, 16, 32):
    n = SIZE // s
    gy, gx = np.mgrid[:n, :n]
    grids.append(np.stack([gx, gy], -1).reshape(-1, 2)); strides.append(np.full((n * n, 1), s))
g = np.concatenate(grids).astype(np.float32); sv = np.concatenate(strides).astype(np.float32)
xy = (out[:, :2] + g) * sv; wh = np.exp(out[:, 2:4]) * sv         # boxes in 416-space
score = out[:, 4:5] * out[:, 5:]                                  # obj x class (already sigmoid)
cls, conf = score.argmax(1), score.max(1)
for i in np.where(conf > 0.35)[0]:                                # + per-class NMS in practice
    x1, y1 = (xy[i] - wh[i] / 2) / r; x2, y2 = (xy[i] + wh[i] / 2) / r
    print(f"coco class {cls[i]}  {conf[i]:.2f}  [{x1:.0f},{y1:.0f},{x2:.0f},{y2:.0f}]")

Performance

COCO val2017 AP 25.8 (FP32 reference). Real-time on Pixel 8a GPU.

Training data & PII

Trained by Megvii on COCO 2017 (train2017), a public academic object-detection dataset (Creative Commons). COCO images contain people as one of the 80 object categories; no names, identities, or other personal attributes are modeled or output — the model emits only class id + box. No additional or private data was used. Weights are the official Megvii release; only the op graph was re-authored for GPU (weights unchanged).

Sample app + conversion script

Android sample (CompiledModel GPU, Kotlin decode + NMS) and the litert_torch conversion script: https://github.com/google-ai-edge/litert-samples (compiled_model_api/object_detection)

Performance

Measured on a Pixel 8a (Tensor G3, Android 16) with the standard TFLite benchmark_model tool — 10 warm-up runs then 50 timed runs, reported as the tool's mean.

RuntimeBackendGraph on GPULatency
TFLite benchmark_model (TfLiteGpuDelegateV2)GPU (OpenCL)482 / 48224.0 ms
TFLite benchmark_modelCPU (XNNPACK, 4 threads)—XNNPACK declined the graph

Any on-device figure recorded when this model shipped came from a different runtime. It was taken through LiteRT's own CompiledModel accelerator (logcat reports it as LITERT_CL), which is the path the Kotlin sample app and the LiteRT API use, and it appears elsewhere on this card. The rows above are the classic TFLite OpenCL delegate, measured with a tool anyone can download and re-run. The two are not comparable, so read the rows above as a reproducible floor rather than as this model's speed on LiteRT.

XNNPACK declines these fp16 graphs — it reports failed to delegate DEPTHWISE_CONV_2D and then fails to allocate tensors — so there is no usable CPU number. Disabling XNNPACK falls back to reference kernels, which measured about 20× slower than the GPU on models of this size and would not represent CPU inference anyone would ship.

Snapdragon NPU (Hexagon)

The NPU is 1.98x faster than the GPU (1.38 ms against 2.74 ms) and loads 9.69x faster (98 ms against 954 ms).

backendinference (median / min)load
NPU (Hexagon v81)1.38 ms / 1.34 ms98 ms
GPU (Adreno)2.74 ms / 1.94 ms954 ms

Measured on a Samsung Galaxy S26 (Snapdragon 8 Elite Gen 5 / SM8850, Hexagon v81, Android 16), LiteRT CompiledModel 2.2.0, one accelerator per process, 5 warm-up runs then N=50 timed runs, median reported. Every run held thermal status NONE throughout. Headroom 0.67, where 1.0 is the throttling threshold.

The NPU rows here ran artifacts compiled ahead of time for SM8850 with QAIRT 2.47.0; the GPU rows ran the published files as they are. LiteRT can also compile for the NPU on the device at first load, which is what lets you ship the published file unchanged — that path and the ten runtime libraries it needs are in the NPU recipe, and we did not measure it here. GPU wiring is in the GPU recipe.

Raspberry Pi 5 (CPU)

Measured on a Raspberry Pi 5 Model B Rev 1.1 (8 GB, Raspberry Pi OS 64-bit) with the LiteRT benchmark_model tool from litert-cli-nightly 0.2.0.dev20260805: CPU inference (XNNPACK, 4 threads), 3 invocations per file of 10 warm-up plus 50 timed runs (the tool caps a phase at 150 s, so very slow graphs run fewer — the Runs column is the actual timed total). The latency is the median across invocations; the spread is the min–max over all timed runs. No thermal throttling occurred during these runs (vcgencmd get_throttled stayed 0x0).

FileInference (median)Spread (min–max)RunsPeak memory
yolox_nano.tflite26.2 ms26.0–27.4 ms150113 MB

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · litert

Нельзя запустить

В репозитории нет весов в формате PyTorch/safetensors.

Ревизия весов
50af925

0 моделей