litert-community / DewarpNet-LiteRT

huggingface.co
Total runs: 435
24-hour runs: 6
7-day runs: 84
30-day runs: 398
Model's Last Updated: September 08 2026
image-to-image

Introduction of DewarpNet-LiteRT

Model Details of DewarpNet-LiteRT

DewarpNet — Document unwarping (LiteRT GPU)

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.

  • Architecture: WCNet (UNet, world-coords) → BMNet (DenseNet, backward map) — pure CNN.
  • Weights: cvlab-stonybrook/DewarpNet (doc3d) · MIT.
  • Size: 189 MB.

DewarpNet document dewarping

Left: photographed curved page. Right: dewarped/rectified. Input photo: Unsplash (free license).

I/O
  • Input: [1, 3, 256, 256] NCHW, BGR , x/255 .
  • Output: [1, 2, 128, 128] backward-mapping grid (values ~`[-1,1]`).
  • Host-side unwarp: blur the map (3×3), resize to the original image size, then grid_sample(original_image, map) → the flattened document.
GPU conversion

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).

Minimal usage
Kotlin (Android, LiteRT CompiledModel GPU)
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
Python (LiteRT / ai-edge-litert)
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
Conversion

Converted with litert-torch ( build_dewarp.py ): loads the two CNNs, applies the ZeroStuffConvT2d + clamp patches, and exports the image→backward-map graph.

License

MIT (DewarpNet / cvlab-stonybrook). Trained on the Doc3D dataset.

Runs of litert-community DewarpNet-LiteRT on huggingface.co

435
Total runs
6
24-hour runs
36
3-day runs
84
7-day runs
398
30-day runs

More Information About DewarpNet-LiteRT huggingface.co Model

More DewarpNet-LiteRT license Visit here:

https://choosealicense.com/licenses/mit

DewarpNet-LiteRT huggingface.co

DewarpNet-LiteRT huggingface.co is an AI model on huggingface.co that provides DewarpNet-LiteRT's model effect (), which can be used instantly with this litert-community DewarpNet-LiteRT model. huggingface.co supports a free trial of the DewarpNet-LiteRT model, and also provides paid use of the DewarpNet-LiteRT. Support call DewarpNet-LiteRT model through api, including Node.js, Python, http.

litert-community DewarpNet-LiteRT online free

DewarpNet-LiteRT huggingface.co is an online trial and call api platform, which integrates DewarpNet-LiteRT's modeling effects, including api services, and provides a free online trial of DewarpNet-LiteRT, you can try DewarpNet-LiteRT online for free by clicking the link below.

litert-community DewarpNet-LiteRT online free url in huggingface.co:

https://huggingface.co/litert-community/DewarpNet-LiteRT

DewarpNet-LiteRT install

DewarpNet-LiteRT is an open source model from GitHub that offers a free installation service, and any user can find DewarpNet-LiteRT on GitHub to install. At the same time, huggingface.co provides the effect of DewarpNet-LiteRT install, users can directly use DewarpNet-LiteRT installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

DewarpNet-LiteRT install url in huggingface.co:

https://huggingface.co/litert-community/DewarpNet-LiteRT

Url of DewarpNet-LiteRT

Provider of DewarpNet-LiteRT huggingface.co

litert-community
ORGANIZATIONS

Other API from litert-community