Mosaic Restore
De-pixelate anything in ComfyUI without an API key or a prayer
- image
- image
- mask
So you've got a pixelated/mosaic'd region - a face, a tag, a watermark-era square blob - and you want it back. The Mosaic Restore node is the thing you plug between your image and your Save button. It detects mosaic/pixelated regions with a YOLO detector and runs them through BasicVSR++, the same inference pipeline that powers ladaapp/lada. No API key, no cloud, no account. Feed it a tensor, get a tensor back.
Set expectations before you hit run: mosaic restoration is bounded by how much information the censoring destroyed. This node mirrors lada as closely as it can, so you get lada-quality output - sometimes that's genuinely enough, sometimes it isn't. Reddit users who've run lada on video describe exactly this split: "works really well, not sure about images," and "removed the pixels but the face remains completely blurred" on heavy censoring. That's not a bug, it's information theory being rude. For the heaviest mosaics the README itself points you to Schwi-AI/DiffusionCreamPy, a diffusion-based restorer that costs more compute but does better. Start here, escalate there.
How it works
Two paths, one input. The node looks at how many frames you gave it and picks automatically - no toggle.
- Single image. BasicVSR++ is a video restorer; a still gives it nothing to track. So the node makes five tiny pan-shifted copies of each detected crop (sub-pixel shifts of 1–2px), runs them through the model as a fake video, un-shifts the outputs and averages. The flow network now sees real motion to lock onto, which beats the obvious "send the same frame 5 times" trick by a visible margin.
- Batch / video frames. Each frame is detected, overlapping detections are chained across frames into tracks, and each track's clip goes through BasicVSR++ in one pass - up to 180 frames per chunk - so the model uses actual motion between frames. That's exactly what lada's own video mode does.
Detection crops run at 256×256, the size the restoration models were trained on. Models aren't bundled with the repo: on first use each is downloaded from the official ladaapp/lada HuggingFace repo into ComfyUI/models/mosaic_restore/, SHA256-verified, and cached.
The inputs that matter
Most of the six knobs you can leave alone. The three worth touching:
detection_model- the YOLO11 detector.v4-fast(the default, ~6MB) is the right call;v4-accurate(~45MB) costs speed for slightly more recall.restoration_model-basicvsrpp-v1.2(default, ~78MB) is the best general-purpose restorer.deepmosaicsis a legacy baseline the author kept for comparison and is usually worse - don't reach for it unless you're A/B-testing.detect_face_mosaics- off by default, matching lada's NSFW-only behavior. Flip it on if your mosaics are over faces and the detector is skipping them.
The rest are situational. fp16 is on by default (faster, imperceptible cost) - disable it on CPU or if you see NaN outputs. device is auto, which you can mostly trust. keep_loaded (default off) pins models in VRAM between runs for faster re-use; turn it on if you're doing many images, leave it off if VRAM is tight. debug replaces the image output with a 2×2 grid - source / restored / detections tinted red / a change heatmap - which is a genuinely handy way to see what the detector found and what the model actually changed.
Outputs
Two of them:
image- the restored frames (or the debug grid, whendebugis on).mask- a per-frame detection mask, 1.0 inside mosaic regions, 0 elsewhere. Wire it into a mask-aware node if you want to do something else with the detected areas, or just to see what got caught.
Installation
Easiest via ComfyUI Manager (search "Mosaic Restore"), or the old-fashioned way:
cd ComfyUI/custom_nodes
git clone https://github.com/L33chKing/ComfyUI-MosaicRestore
Restart ComfyUI. The first run pip-installs ultralytics if you don't have it; you'll also get opencv-python and torch (which you already have). Then add Mosaic Restore from the image/restoration category. The first time you select a model it downloads - a few MB for the detector, ~78MB for the restorer, so it's not the multi-gigabyte haul some packs demand.
Where people get burned
- Expecting magic on heavy mosaics. It's a deterministic restorer, not a diffusion model. If output looks smeared, that's the ceiling, not a misconfiguration - switch to a diffusion-based restorer for the hard cases.
- The DeepMosaics weight comes from Google Drive, not HuggingFace. If your network or firewall eats that download, the node falls over on that model - stick with the BasicVSR++ variants.
- NaN or garbage output on CPU - flip
fp16off. - Detection misses a region - first try
detect_face_mosaicsif it's a face, then thev4-accuratedetector before blaming anything else.
One honest note on licensing: this pack reuses AGPL-3.0 code from lada and GPL code from DeepMosaics, and is itself AGPL-3.0. Fine for personal use; worth knowing before you build commercial product on it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| detection_model | COMBO | v4-fast | 4 options: v4-fast, v4-accurate, v3.1-fast, v3.1-accurate |
| restoration_model | COMBO | basicvsrpp-v1.2 | 3 options: basicvsrpp-v1.2, basicvsrpp-v1.1, deepmosaics |
| device | COMBO | auto | 4 options: auto, cuda, mps, cpu |
| fp16 | BOOLEAN | true | Run detection + restoration in half precision. Significantly faster on most GPUs at imperceptible quality cost. Disable on CPU or if you observe NaN outputs. |
| detect_face_mosaics | BOOLEAN | false | If enabled, also restore mosaics that the detector classifies as faces/heads. Off by default to match lada's NSFW-only behaviour. |
| debug | BOOLEAN | false | When enabled the image output is replaced with a 2x2 grid per frame: top-left = source, top-right = restored output, bottom-left = detection regions tinted red, bottom-right = absolute pixel-difference heatmap of what the restoration model changed. |
| keep_loaded | BOOLEAN | false | Keep the detection + restoration models resident in VRAM between runs for faster subsequent invocations. Disable to free GPU memory back to ComfyUI as soon as the node finishes (useful when VRAM is tight or you only run mosaic restoration once per workflow). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |