image-to-image (low-light enhancement) · vision · WASM · ~0.4 MB
Give this model an under-exposed or night photo and it recovers a properly-lit one: it lifts brightness, fixes colour, and pulls detail out of the shadows. IAT — the Illumination Adaptive Transformer (BMVC 2022) — is a tiny ~90K-parameter network that predicts a per-pixel illumination correction, so it's a learned exposure/tone fix, not a blunt brightness slider. Runs entirely on your device via ONNX Runtime Web; the photo never leaves the tab.
| Model | Pezhgorski/IAT-ONNX — iat_lol_v1 variant (trained on the LOL low-light dataset) |
|---|---|
| Base | cuiziteng/Illumination-Adaptive-Transformer (IAT, Cui et al., BMVC 2022) |
| Task | image-to-image (low-light enhancement / exposure correction) — run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no IAT class / no low-light-enhancement task) |
| Input | [1, 3, H, W] float32 — the dark image, values 0–1 (no normalisation); dynamic height/width |
| Output | three tensors — mul (per-pixel gain), add (offset), enhanced (the corrected image, 0–1); we display enhanced and visualise mul |
| Quantization | fp32 ONNX (weights in an external-data sidecar) — runs on the plain WASM execution provider, no WebGPU needed |
| Backend | WebAssembly (single-threaded on GitHub Pages) — a pass is well under a second at typical sizes (~90K params) |
| Download | ~0.4 MB (66 KB graph + 347 KB weights), cached after first load (auto-inits on return) |
| License | Apache-2.0 (ONNX export) · IAT (Apache-2.0) |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, ImageBitmap — all Baseline widely available |
Pick a photo and dial it dark so you can watch IAT recover it — or drop your own genuinely dark / night photo. Drag the divider to compare dark vs enhanced.
The wipe above is the real evidence — slide it to watch the shadows open up. “Brightness” is the mean Rec.709 luminance and “contrast” the RMS luminance spread, measured on the actual pixels before → after. IAT predicts a per-pixel illumination correction, so dark regions get lifted more than already-bright ones — see the gain map below.
Everything runs on your device — the photo and every enhanced pixel never leave the tab. Gallery images are rights-cleared samples (see each caption for the source).
IAT doesn't apply one global brightness — it predicts an illumination gain map: the
mul tensor, a per-pixel multiplier telling each region how much to brighten. This is that
map. Warm/amber = high gain (the model decided this area was too dark and lifted it hard); dark indigo =
low gain (already well-lit, leave it). That spatial variation is what separates a learned exposure fix
from a flat “+40% brightness”.
gain range –
Amber traces the darkest parts of the scene — shadows, night sky, under-lit faces — where IAT applied the most gain. A crude brightness slider would raise everything equally and blow out the highlights; IAT’s map is uneven because it corrects the illumination locally, keeping the already-bright regions in check.
Low light is where phone cameras and webcams fall apart. On-device enhancement means you can rescue a dark shot privately, with no upload and no per-image cloud cost — and the model is so small (~0.4 MB) it loads instantly:
IAT recovers detail that’s there but buried in the shadows; it can’t invent information that pure black erased. Extreme darkness recovers partially — it’s a rescue, not a light source.
Dial a photo dark, then watch IAT recover it — wipe between dark and enhanced and see the brightness jump.
Rescue an under-exposed photo so faces and detail are visible again, then download the enhanced image.
Push it: crank the darkness to near-black and find where recovery starts to run out of signal.
Enhance → colourize: brighten a dark scene, then run the colourizer, or feed it to object detection.
transformers.js has no IAT class and no low-light task, so we run the ONNX graph directly with ONNX Runtime Web. In goes the dark image, out comes the enhanced one (plus the gain/offset maps):
import * as ort from "onnxruntime-web";
// weights live in an external-data sidecar → pass it to the session
const session = await ort.InferenceSession.create(iatBytes, {
executionProviders: ["wasm"],
externalData: [{ path: "iat_lol_v1.onnx.data", data: dataBytes }],
});
// dark image → [1,3,H,W] float32 in [0,1] (no normalisation; H,W dynamic)
const input = new ort.Tensor("float32", toNCHW(dark, W, H), [1, 3, H, W]);
const { enhanced, mul } = await session.run({ input });
// enhanced is [1,3,H,W] in [0,1] → clamp to RGBA. mul is the illumination gain map.
const lit = tensorToImage(enhanced.data, W, H);
Inference and the whole output composite run in a Web Worker so the UI never blocks, and the tiny model is fetched through Cache Storage, so a returning visit auto-initialises with no re-download.