Instructions to use mlboydaisuke/vdsr-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use mlboydaisuke/vdsr-litert with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
| license: mit | |
| library_name: litert | |
| pipeline_tag: image-to-image | |
| tags: | |
| - litert | |
| - tflite | |
| - on-device | |
| - android | |
| - super-resolution | |
| - vdsr | |
| - gpu | |
| # VDSR — LiteRT (TFLite) GPU, FP16 | |
| On-device [LiteRT](https://ai.google.dev/edge/litert) (`.tflite`) conversion of | |
| **VDSR** (Very Deep Super-Resolution, CVPR'16) for single-image super-resolution. | |
| VDSR is a 20-layer CNN that refines the **luminance (Y)** of an image and adds a global | |
| residual. | |
| The model runs **fully on the LiteRT `CompiledModel` GPU accelerator** (ML Drift): every | |
| op is GPU-native, no CPU fallback, no Flex/Custom ops. Converted with | |
| [`litert-torch`](https://github.com/google-ai-edge/ai-edge-torch) **with no patches** — | |
| VDSR has no in-network upsampling, so the graph is just `conv + ReLU + residual add` | |
| (no PixelShuffle, no PReLU), unlike most SR models. | |
| ## Files | |
| | File | Precision | Size | | |
| |------|-----------|------| | |
| | `vdsr_256_fp16.tflite` | fp16 weights | ~1.35 MB | | |
| | `vdsr_256.tflite` | fp32 | ~2.68 MB | | |
| ## I/O | |
| - **Input**: `[1, 256, 256, 1]` float32, **NHWC**, the luminance (Y) of a bicubic-upscaled | |
| image, range `[0, 1]`. | |
| - **Output**: `[1, 256, 256, 1]` float32, **NHWC**, the refined (sharper) Y, range `[0, 1]`. | |
| To super-resolve a color image: convert to YCbCr, run Y through the model, recombine the | |
| refined Y with the original Cb/Cr, convert back to RGB. | |
| ## Ops | |
| ``` | |
| CONV_2D x19, DEPTHWISE_CONV_2D x1, ADD x1 | |
| ``` | |
| No `GATHER_ND`, no Flex/Custom, no PixelShuffle/PReLU. | |
| ## Fidelity | |
| - Converted fp32 vs original PyTorch: **corr 1.0000**. | |
| - fp16 vs fp32: **corr 1.0000**. | |
| ## On-device (Pixel 8a, verified) | |
| The fp16 model compiles to **41 / 41 nodes on the LiteRT GPU delegate (LITERT_CL)** — | |
| full GPU residency, no CPU fallback. | |
| ## Usage (Android, LiteRT CompiledModel) | |
| ```kotlin | |
| val model = CompiledModel.create( | |
| context.assets, "vdsr_256_fp16.tflite", | |
| CompiledModel.Options(Accelerator.GPU), null | |
| ) | |
| val inputs = model.createInputBuffers() | |
| val outputs = model.createOutputBuffers() | |
| inputs[0].writeFloat(yChannel) // [1,256,256,1] luminance in [0,1] | |
| model.run(inputs, outputs) | |
| val refinedY = outputs[0].readFloat() // [1,256,256,1] in [0,1] | |
| ``` | |
| A complete Android sample (camera + gallery super-resolution) is available in | |
| [google-ai-edge/litert-samples](https://github.com/google-ai-edge/litert-samples). | |
| ## License & attribution | |
| - License: **MIT**. Weights from [`twtygqyy/pytorch-vdsr`](https://github.com/twtygqyy/pytorch-vdsr). | |
| Original work: Kim et al., *"Accurate Image Super-Resolution Using Very Deep | |
| Convolutional Networks"*, CVPR 2016. This is a format conversion of the weights (no | |
| architectural changes); all credit to the original authors. | |