CoolFace
Modelpublic

mlboydaisuke/real-esrgan-x4v3-litert

sourceHugging Facebsd-3-clauseupdated 1mo agoView on Hugging Face
0likes15downloads
Model Card

Real-ESRGAN General x4v3 — LiteRT (CompiledModel GPU)

Real-ESRGAN realesr-general-x4v3 (SRVGGNetCompact, ~1.2M params, BSD-3-Clause) re-authored to a GPU-native LiteRT .tflite via the official litert_torch path. ×4 real-world super-resolution. FP16, 3.5 MB, input 128×128 → output 512×512 (NHWC, RGB, 0–1).

Verified on a Pixel 8a: the whole graph runs on the GPU delegate (full LITERT_CL residency, 211/211 nodes, 1 partition) in ~1 ms, and the GPU output matches the CPU/PyTorch reference (corr ≈ 0.995).

Why this is GPU-clean

A pure CNN, but the stock conversion isn't GPU-clean: PReLU lowers to GREATER+SELECT+MUL and PixelShuffle lowers to a >4-D reshape — both GPU-rejected. Here:

  • —PReLU → `relu(x) − a·relu(−x)` (per-channel a): exact, only RELU/MUL/SUB.
  • —PixelShuffle(4) → a one-hot ConvTranspose(stride 4) → ZeroStuffConvT (zero-stuff nearest + Conv2d): exact, no TRANSPOSE_CONV, no >4-D tensors.

Result: zero GATHER/SELECT/TopK/Cast, no >4-D tensors — full GPU residency. Re-authored vs original: corr 1.000000.

I/O

  • —Input [1, 128, 128, 3] NHWC, RGB, 0–1 float (no mean/std). Tile larger images into 128×128 patches.
  • —Output [1, 512, 512, 3] NHWC, RGB, 0–1 (clamp to [0,1]). ×4 upscale.

Training data & PII

realesr-general-x4v3 was trained by the Real-ESRGAN authors on public super-resolution datasets (DIV2K / Flickr2K / OST and a synthetic high-order degradation pipeline). The model upscales image pixels only — no faces, identities, or other personal attributes are detected, recognized, or output. No additional or private data was used; weights are the official release, only the op graph was re-authored for GPU.

Sample app + conversion script

Android sample (CompiledModel GPU, before/after compare) and the litert_torch conversion script: https://github.com/google-ai-edge/litert-samples (compiledmodelapi/super_resolution)

<!-- funnel:v1 -->


Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.

<!-- /funnel:v1 -->