image-to-image (dehazing) Β· vision Β· WASM Β· ~4 MB
Give this model a hazy or foggy photo β a washed-out landscape, a misty street, an aerial shot lost in atmosphere β and it recovers the clear scene: restored contrast, revived colour, distant detail pulled back out of the murk. MicroDehazeNet is a tiny (~1M-parameter) single-image dehazing network trained on the Haze4K benchmark. It's not a contrast slider β it estimates and removes the scene's haze the way physics laid it down. Runs entirely on your device via ONNX Runtime Web; the photo never leaves the tab.
| Model | Vive-k-kumar/micro-dehaze-net β MicroDehazeNet (996K params, base_channels 24), trained on Haze4K |
|---|---|
| Task | image-to-image (single-image dehazing) β run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no dehazing class / no dehazing task) |
| Input | hazy_input [1, 3, H, W] float32 in 0β1 β the hazy image, plain RGB (no normalisation), H/W rounded to a multiple of 8 |
| Output | dehazed_output [1, 3, H, W] float32 in ~0β1 β the haze-removed image, resized back to your photo's aspect |
| 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 512-px pass is under a second |
| Download | ~4 MB (0.2 MB graph + 3.8 MB weights), cached after first load (auto-inits on return) |
| License | MIT Β· trained on Haze4K |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, ImageBitmap β all Baseline widely available |
Pick an outdoor photo and add a known haze so you can watch the network clear it β or drop your own genuinely hazy photo. Drag the divider to compare hazy vs dehazed.
The wipe above is the real evidence β slide it to watch the murk lift. βContrastβ is the RMS contrast of luminance (the standard clarity measure) before β after; haze flattens it and dehazing restores it, landing near the un-hazed scene's own contrast.
Everything runs on your device β the photo and every dehazed pixel never leave the tab. Gallery images are rights-cleared samples (see each caption for the source).
Where did the model actually do something? This is the haze-removed map: the per-pixel difference between the hazy input and the dehazed output, amplified. It glows in the regions the model cleared β usually the distant, low-transmission areas where the haze was thickest β and stays dark where little needed removing. It's a proxy for the scene's transmission map: how much atmosphere each pixel was seen through.
Warm amber = big change (thick haze lifted); dark teal = untouched. A flat contrast filter would change every pixel by roughly the same amount; MicroDehazeNet removes more where the atmosphere was denser, which is why the map traces depth β brightest toward the horizon, dim in the foreground.
Haze, fog and atmospheric murk wash out contrast, mute colour and hide distant structure. On-device dehazing recovers the clear scene privately, with no upload and no per-image cloud cost:
MicroDehazeNet estimates and removes plausible haze; it can't invent detail that dense fog erased completely. Heavy haze clears partially β it's a rescue, not X-ray vision.
Haze a photo, then watch the network clear it β wipe between hazy and dehazed and see the contrast jump back.
Restore a real foggy landscape or drone shot so distance and colour come back, then download the cleared image.
Push it: crank the haze to a whiteout and find the point where dehazing starts to give up.
Dehaze β detect: clear the haze, then run object detection on the result to find things the fog was hiding.
transformers.js has no dehazing class and no dehazing task, so we run the ONNX graph directly with ONNX Runtime Web. In goes the hazy image, out comes the clear one:
import * as ort from "onnxruntime-web";
// the .onnx graph references its weights in an external-data sidecar (.onnx.data)
const session = await ort.InferenceSession.create(graphBytes, {
executionProviders: ["wasm"],
externalData: [{ path: "micro_dehaze_net.onnx.data", data: weightBytes }],
});
// hazy image β [1,3,H,W] float32 in [0,1] (plain RGB, no normalisation)
const input = new ort.Tensor("float32", toNCHW(hazy, W, H), [1, 3, H, W]);
const { dehazed_output } = await session.run({ hazy_input: input });
// dehazed_output is [1,3,H,W] in [0,1] β clamp to RGBA and resize back to the original aspect
const clear = tensorToImage(dehazed_output.data, W, H);
Inference and the whole output composite run in a Web Worker so the UI never blocks, and the ~4 MB model is fetched through Cache Storage, so a returning visit auto-initialises with no re-download.