Downloads · 30 days
132
55% of all-time downloads
litert-community/Cloth-Segmentation-U2Net-LiteRT
Cloth-Segmentation-U2Net-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): Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 6545 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 115 ms p50 · output differ…
Downloads · 30 days
132
55% of all-time downloads
All-time downloads
239
Public
Repo size
177 MB
Likes
2
Public
Click a slice to open those files.
.tflite176 MB · 100%
From the Hugging Face model README
Measured on device (edge-compat): Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 6545 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 115 ms p50 · output differs from CPU (max rel diff 0.17) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/cloth-segmentation-u2net/CARD.md
On-device clothing segmentation running fully on the LiteRT CompiledModel GPU
delegate (no CPU fallback). cloth-segmentation
is a U²-Net trained on iMaterialist-Fashion to segment upper-body / lower-body /
full-body clothing — the building block for virtual try-on and fashion apps. ~88 ms/frame
on a Pixel 8a.

Upper-body clothing (cyan) + lower-body (orange). Photo: Unsplash (free license).
[1, 3, 768, 768] NCHW, RGB, (x/255 - 0.5)/0.5 (i.e. [-1, 1]).[1, 4, 768, 768] logits — argmax over the 4 classes: 0 = background,
1 = upper body, 2 = lower body, 3 = full body (dress).U²-Net is a pure CNN → fully GPU-compatible (254/254 nodes on the delegate, 1
partition; device corr 0.999798, ~88 ms) with one defensive patch: align_corners=True
→ False on the bilinear upsamples (the GPU delegate rejects align_corners=True).
CPU-exact vs PyTorch (corr 1.0).
val options = CompiledModel.Options(Accelerator.GPU)
val model = CompiledModel.create(context.assets, "clothseg.tflite", options, null)
val inBufs = model.createInputBuffers()
val outBufs = model.createOutputBuffers()
inBufs[0].writeFloat(inputNCHW) // [1,3,768,768] RGB, (x/255-0.5)/0.5
model.run(inBufs, outBufs)
val out = outBufs[0].readFloat() // [4*768*768]; per pixel p argmax over the 4 class planes
// class 0 bg, 1 upper, 2 lower, 3 full-body
import numpy as np
from ai_edge_litert.interpreter import Interpreter
it = Interpreter(model_path="clothseg.tflite"); it.allocate_tensors()
inp, out = it.get_input_details(), it.get_output_details()
it.set_tensor(inp[0]["index"], x) # [1,3,768,768] float32, RGB, (x/255-0.5)/0.5
it.invoke()
seg = it.get_tensor(out[0]["index"])[0].argmax(0) # [768,768] 0=bg 1=upper 2=lower 3=full
Converted with litert-torch (build_clothseg.py): loads the MIT U²-Net cloth weights
and exports the 4-class graph.
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 | 254 / 254 | ~88 ms |
TFLite benchmark_model (TfLiteGpuDelegateV2) | GPU (OpenCL) | 254 / 254 | 496.4 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.29x faster than the GPU (65.47 ms against 149.9 ms) and loads 7.76x faster (247 ms against 1919 ms).
| backend | inference (median / min) | load |
|---|---|---|
| NPU (Hexagon v81) | 65.47 ms / 62.06 ms | 247 ms |
| GPU (Adreno) | 149.9 ms / 146.3 ms | 1919 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.54-0.61, 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.
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 |
|---|---|---|---|---|
clothseg.tflite | 6,544.6 ms | 6,414.9–6,715.9 ms | 69 | 1823 MB |
MIT (cloth-segmentation / levindabhi). Trained on iMaterialist-Fashion-2019.