Instructions to use mlboydaisuke/zero-dce-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use mlboydaisuke/zero-dce-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: apache-2.0 | |
| library_name: litert | |
| pipeline_tag: image-to-image | |
| base_model: sayakpaul/zero-dce | |
| tags: | |
| - litert | |
| - tflite | |
| - on-device | |
| - android | |
| - low-light-enhancement | |
| - image-enhancement | |
| - zero-dce | |
| - gpu | |
| # Zero-DCE — LiteRT (TFLite) GPU, FP16 | |
| On-device [LiteRT](https://ai.google.dev/edge/litert) (`.tflite`) conversion of | |
| **[Zero-DCE](https://github.com/Li-Chongyi/Zero-DCE)** (Zero-Reference Deep Curve | |
| Estimation) for **low-light image enhancement**. The DCE-Net is a tiny 7-layer CNN | |
| that estimates pixel-wise tone curves; the curves are applied iteratively (8×) to | |
| brighten the image. The whole pipeline (curve estimation **and** the iterative | |
| application) is baked into the graph, so the model takes a dark image and returns the | |
| enhanced image directly. | |
| 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**. | |
| ## Files | |
| | File | Precision | Size | | |
| |------|-----------|------| | |
| | `zerodce_512_fp16.tflite` | fp16 weights | ~0.18 MB | | |
| | `zerodce_512.tflite` | fp32 | ~0.34 MB | | |
| ## I/O | |
| - **Input**: `[1, 512, 512, 3]` float32, **NHWC**, RGB, range **`[0, 1]`** (just divide | |
| by 255 — no mean/std normalization). | |
| - **Output**: `[1, 512, 512, 3]` float32, **NHWC**, RGB, range `[0, 1]` — the enhanced | |
| image. Multiply by 255 to display. | |
| ## Ops | |
| The graph lowers entirely to GPU-clean builtins — the iterative curve application | |
| `x = x + r·(x² − x)` is written as `x*x` so it becomes `MUL`, not `POW`: | |
| ``` | |
| CONV_2D x7, MUL x16, SUB x8, ADD x8, SLICE x8, CONCATENATION x3, TANH x1 | |
| ``` | |
| No `GATHER_ND`, no Flex/Custom, no >4D reshapes. | |
| ## Fidelity | |
| - Converted fp32 vs original PyTorch: **corr 1.0000**, max|diff| ~2e-5. | |
| - fp16 vs fp32: **corr 1.0000**, max|diff| ~3e-5. | |
| ## On-device (Pixel 8a, verified) | |
| The fp16 model compiles to **58 / 58 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, "zerodce_512_fp16.tflite", | |
| CompiledModel.Options(Accelerator.GPU), null | |
| ) | |
| val inputs = model.createInputBuffers() | |
| val outputs = model.createOutputBuffers() | |
| inputs[0].writeFloat(rgbFloats01) // [1,512,512,3] interleaved RGB in [0,1] | |
| model.run(inputs, outputs) | |
| val enhanced = outputs[0].readFloat() // [1,512,512,3] in [0,1] | |
| ``` | |
| A complete Android sample (live camera + gallery low-light enhancement) is available in | |
| [google-ai-edge/litert-samples](https://github.com/google-ai-edge/litert-samples). | |
| ## License & attribution | |
| - License: **Apache-2.0** (© the Zero-DCE authors, | |
| [Li-Chongyi/Zero-DCE](https://github.com/Li-Chongyi/Zero-DCE)). Original work: | |
| Guo et al., *"Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement"*, | |
| CVPR 2020. This is a format conversion of the official weights (no architectural | |
| changes); all credit to the original authors. | |