Downloads · 30 days
93
51% of all-time downloads
litert-community/YOLACT-ResNet50-LiteRT
YOLACT-ResNet50-LiteRT is a image segmentation model from litert-community. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. It is set up for litert. The card lists the license as mit.
Measured on device (edge-compat): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 38.4 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 14.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804…
Downloads · 30 days
93
51% of all-time downloads
All-time downloads
181
Public
Repo size
125 MB
Likes
1
Public
Click a slice to open those files.
.tflite125 MB · 99%
From the Hugging Face model README
Measured on device (edge-compat): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 38.4 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 14.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 1096 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 63.1 ms p50 · output matches CPU (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/yolact-resnet50/CARD.md
On-device real-time instance segmentation running fully on the LiteRT
CompiledModel GPU delegate (no CPU fallback). YOLACT
(ICCV 2019) predicts per-instance COCO masks. The network (ResNet50 + FPN +
protonet + heads) runs on the GPU; the lightweight decode (NMS + linear-combination
masks) runs host-side. ~41 ms/graph on a Pixel 8a.
yolact_resnet50_54_800000) · MIT.
yolact.tflite — the GPU graph (input [1,3,550,550] NCHW).priors.bin — 19248 SSD priors [cx,cy,w,h] (float32) used by the host-side box decode.[1, 3, 550, 550] NCHW, BGR, normalized (x - [103.94,116.78,123.68]) / [57.38,57.12,58.40]
(no /255).loc [1,19248,4], conf [1,19248,81] (softmax, incl. background),
mask [1,19248,32] (coefficients), proto [1,138,138,32] (prototype masks).decode(loc, priors, variances=[0.1,0.2]).mask = sigmoid(proto @ coeff) → crop
to the box → threshold 0.5 → upscale.Base YOLACT is a pure CNN, so the graph converts fully GPU-compatible (138/138
nodes on the delegate, 1 partition; device corr 0.99999–1.0 vs PyTorch on all four
raw outputs) with one patch: the ResNet50 stem MaxPool2d(padding=1) lowers to a
-inf PADV2 (rejected by Mali), replaced by a 0-pad + unpadded maxpool (exact
post-ReLU). The scripted FPN is made traceable by disabling YOLACT's JIT
(use_jit=False). CPU-exact vs PyTorch (corr 1.0).
val options = CompiledModel.Options(Accelerator.GPU)
val model = CompiledModel.create(context.assets, "yolact.tflite", options, null)
val inBufs = model.createInputBuffers()
val outBufs = model.createOutputBuffers() // map by size: loc=N*4, conf=N*81, mask=N*32, proto=138*138*32
inBufs[0].writeFloat(inputNCHW) // [1,3,550,550] BGR, (x-[103.94,116.78,123.68])/[57.38,57.12,58.40]
model.run(inBufs, outBufs)
val loc = outBufs[iLoc].readFloat() // [19248*4]
val conf = outBufs[iConf].readFloat() // [19248*81] (softmax)
val mask = outBufs[iMask].readFloat() // [19248*32] coefficients
val proto = outBufs[iProto].readFloat() // [138*138*32] prototypes
// host-side decode (priors.bin bundled as an asset):
// box = SSD-decode(loc, priors, variances=[0.1,0.2]); per-class NMS (score 0.3, IoU 0.5);
// per kept det: mask = sigmoid(proto @ coeff) (>0) cropped to the box.
// Full implementation: YolactSegmenter.kt in the sample app.
import numpy as np
from ai_edge_litert.interpreter import Interpreter
it = Interpreter(model_path="yolact.tflite"); it.allocate_tensors()
inp, out = it.get_input_details(), it.get_output_details()
it.set_tensor(inp[0]["index"], x) # [1,3,550,550] BGR, normalized (see above)
it.invoke()
outs = {tuple(o["shape"][1:]): it.get_tensor(o["index"])[0] for o in out}
loc = outs[(19248, 4)]; conf = outs[(19248, 81)]
mask = outs[(19248, 32)]; proto = outs[(138, 138, 32)]
priors = np.fromfile("priors.bin", np.float32).reshape(-1, 4)
cxy = priors[:, :2] + loc[:, :2] * 0.1 * priors[:, 2:]
wh = priors[:, 2:] * np.exp(loc[:, 2:] * 0.2)
boxes = np.concatenate([cxy - wh / 2, cxy + wh / 2], 1) # x1y1x2y2 (0..1)
# then per-class NMS on conf, and mask_i = sigmoid(proto @ mask[i]) cropped to boxes[i]
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.
| Runtime | Backend | Graph on GPU | Latency |
|---|---|---|---|
LiteRT CompiledModel (LITERT_CL) | GPU | 138 / 138 | ~41 ms |
TFLite benchmark_model (TfLiteGpuDelegateV2) | GPU (OpenCL) | 138 / 138 | 130.4 ms |
TFLite benchmark_model | CPU (XNNPACK, 4 threads) | — | 1426.2 ms |
The two GPU rows are different runtimes, not a contradiction. The LITERT_CL figure is the one recorded when this model shipped, taken through LiteRT's own CompiledModel accelerator — the path the Kotlin sample app and the LiteRT API use. The TfLiteGpuDelegateV2 figure is the classic TFLite OpenCL delegate, measured with a tool anyone can download and re-run. They agree on how much of the graph the GPU takes; they disagree on speed, and the classic delegate is the slower of the two here. Read the TfLiteGpuDelegateV2 row as a reproducible floor, not as this model's speed on LiteRT.
The NPU is 2.67x faster than the GPU (14.34 ms against 38.37 ms) and loads 13.02x faster (158 ms against 2060 ms).
| backend | compiled | inference (median / min) | load |
|---|---|---|---|
| NPU (Hexagon v81) | on-device JIT | 14.34 ms / 13.89 ms | 158 ms |
| GPU (Adreno) | — | 38.37 ms / 31.57 ms | 2060 ms |
Measured on a Samsung Galaxy S26 (Snapdragon 8 Elite Gen 5 / SM8850, Hexagon v81, Android 16) with 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.77, where 1.0 is the throttling threshold.
The NPU rows ran the published file unchanged. LiteRT compiled it for the Hexagon on the device at first load. That first compile took 12 s here. The load column above is the cached load every later run pays. Recipe and the runtime libraries it needs: NPU guide.
GPU wiring: GPU guide.
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).
| File | Inference (median) | Spread (min–max) | Runs | Peak memory |
|---|---|---|---|---|
yolact.tflite | 1,095.6 ms | 1,077.6–1,107.9 ms | 150 | 376 MB |
MIT (YOLACT / dbolya/yolact). COCO class taxonomy.