Model reference · open weights
DewarpNet-LiteRT is an open-weight image model from litert-community. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | litert-community |
|---|---|
| Type | Image models |
| Task | Image edit |
| Runs with | litert |
| Released | 2026-07-06 |
| Popularity | 507 downloads / month |
| Licence | Open weights |
About
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).
Measured on device (edge-compat): Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 594 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 22.6 ms p50 · output matches CPU (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/dewarpnet/CARD.md
On-device document dewarping / rectification running fully on the LiteRT
CompiledModel GPU delegate (no CPU fallback). DewarpNet
(ICCV 2019) flattens a photographed, curved/folded document — the core of a document
scanner. Two CNNs predict a backward-mapping grid; the network runs on the GPU and the
grid_sample unwarp is a tiny host-side step. ~24 ms/frame on a Pixel 8a.
Left: photographed curved page. Right: dewarped/rectified. Input photo: Unsplash (free license).
[1, 3, 256, 256] NCHW, BGR, x/255.[1, 2, 128, 128] backward-mapping grid (values ~[-1,1]).grid_sample(original_image, map) → the flattened document.DewarpNet is a pure CNN. It converts fully GPU-compatible (371/371 nodes on the
delegate, 1 partition; device corr 0.999866, ~24 ms) with two patches: (1) the
UNet/DenseNet ConvTranspose2d upsamplers → ZeroStuffConvT2d (nearest-upsample +
stride zero-stuff mask + flipped conv; the Mali delegate rejects TRANSPOSE_CONV); and
(2) Hardtanh(0,1) → relu(x) - relu(x-1) (the delegate rejects RELU_0_TO_1). Both
are exact. CPU-exact vs PyTorch (corr 0.9999999999).
val options = CompiledModel.Options(Accelerator.GPU)
val model = CompiledModel.create(context.assets, "dewarp.tflite", options, null)
val inBufs = model.createInputBuffers()
val outBufs = model.createOutputBuffers()
inBufs[0].writeFloat(inputNCHW) // [1,3,256,256] BGR, x/255
model.run(inBufs, outBufs)
val bm = outBufs[0].readFloat() // [2*128*128] backward map (grid, ~[-1,1])
// host: blur 3x3, resize to image size, then bilinear grid_sample(image, bm) -> flattened doc
import numpy as np, cv2, torch, torch.nn.functional as F
from ai_edge_litert.interpreter import Interpreter
it = Interpreter(model_path="dewarp.tflite"); it.allocate_tensors()
inp, out = it.get_input_details(), it.get_output_details()
it.set_tensor(inp[0]["index"], x) # [1,3,256,256] float32, BGR, x/255
it.invoke()
bm = it.get_tensor(out[0]["index"]) # [1,2,128,128]
bm = np.stack([cv2.resize(cv2.blur(bm[0,0],(3,3)), (W,H)),
cv2.resize(cv2.blur(bm[0,1],(3,3)), (W,H))], -1)[None]
flat = F.grid_sample(torch.tensor(imgorg/255.).permute(2,0,1)[None].float(),
torch.tensor(bm).float(), align_corners=True) # unwarped
Converted with litert-torch (build_dewarp.py): loads the two CNNs, applies the
ZeroStuffConvT2d + clamp patches, and exports the image→backward-map 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 | 371 / 371 | ~24 ms |
TFLite benchmark_model (TfLiteGpuDelegateV2) | GPU (OpenCL) | 371 / 371 | 88.3 ms |
TFLite benchmark_model | CPU (XNNPACK, 4 threads) | — | 875.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 3.53x faster than the GPU (4.99 ms against 17.64 ms) and loads 6.25x faster (199 ms against 1243 ms).
| backend | inference (median / min) | load |
|---|---|---|
| NPU (Hexagon v81) | 4.99 ms / 4.95 ms | 199 ms |
| GPU (Adreno) | 17.64 ms / 17.38 ms | 1243 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.71-0.74, 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](https://github.com/john-rocky/hf-to-litertlm/blob/
From the published model card. Full card on the HuggingFace links in the sidebar.
How it works
Using it via the API
Once AxForge deploys dewarpnet-litert for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (dewarpnet-litert below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/images/generations \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"dewarpnet-litert","prompt":"a red bicycle","size":"1024x1024"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.