CV Colorize Model
2016 colorization, still the fun kind of wrong
- image
- image
What this is for
Drop a black-and-white photo in, get a plausible colour version out. This is Zhang et al.'s 2016 colorization network (ECCV), the one that powered the old "colorize your old family photos" demos, running here through cv2.dnn as an ONNX model. It's not a diffusion model and it doesn't take a prompt - it predicts plausible chrominance from luminance, so a grey lawn can come back green or tan depending on what the model thought it was looking at. That unpredictability is the charm for archival photos and the problem for anything you needed to be accurate.
It's also the pack's most honest example of its own stated caveat: everything here goes through cv2.dnn on principle, even where ComfyUI would do it better. For colorization specifically there's no native equivalent, so this node earns its place.
How it works
The network takes the L channel in Lab space and predicts the ab colour channels. The node converts your input to grayscale, runs the forward pass, scales the predicted ab, and merges it back with the original luminance - which is why structure and detail survive perfectly and only the colour is invented. It runs in the pack's interruptible DNN worker, frame by frame for a batch, and the output resolution matches the input.
The model file is the wrinkle: colorization_deploy_v2_2026april.onnx, which you place in ComfyUI/models/onnx yourself. The repo's model_sources.txt records where it came from - OpenCV's own HuggingFace opencv_contribution repository, packaging Zhang's original weights, with the upstream project being richzhang/colorization. The classic trick with this network is that the 313 ab cluster centres have to be grafted onto the network as extra weights; that's handled on this side, which is why it's a curated node and not a generic DNN Forward exercise.
Inputs and outputs
image(required) - grayscale input, but a colour image works too, it's converted to grayscale first. Batches are processed frame by frame.model(required) - the ONNX file fromComfyUI/models/onnx. If the dropdown isn't offering it, you put it in the wrong folder or the folder listing hasn't refreshed.strength(optional, default 1.0) - scales the predicted ab channels. 0 gives you grayscale back (a useful A/B on whether the model is doing anything), 1.0 is the model's honest output, above 1 oversaturates. Values around 0.7–0.8 are where it stops looking like a 2016 paper; the range goes to 2.0 if you want the poster look.
One output: image, same resolution as the input. Wire it to Preview Image.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
# restart ComfyUI
Manager users: ComfyUI CV (publisher bmad4ever), which pulls opencv-contrib-python-headless~=5.0.0.93. Needs Python ≥ 3.12 and a V3-node-API ComfyUI. Then get the model:
cd ComfyUI/models/onnx
# colorization_deploy_v2_2026april.onnx
# from https://huggingface.co/opencv/opencv_contribution
# (submissions/colorization) - see model_sources.txt in the pack for the licence record
Common issues
- The model isn't in the dropdown. Wrong directory, or the node definitions were fetched before you copied the file - reload the page.
- Batching feels glacial. Expected.
cv2.dnnhere runs on the CPU: the wheels are built without CUDA, and on current OpenCV builds the DNN backend/target selectors are inert regardless. Frame interpolation, upscaling, anything ComfyUI has a PyTorch node for - use the native node. This one is for the job core doesn't cover. - Colours look like a 1970s postcard with
strengthat default. Dial it back. The model's raw output is a bit eager. - Contrib-backed nodes from this pack vanished. Something installed a non-contrib OpenCV wheel over the shared
site-packages/cv2;python tools/repair_opencv_contrib.py --checkthen--apply.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Grayscale input image. A colour IMAGE is converted to grayscale before colourization. An IMAGE batch is processed frame by frame; the output resolution matches the input. | |
| model | COMBO | Colorization .onnx model from ComfyUI/models/onnx (colorization_deploy_v2_2026april.onnx). | |
| strengthopt | FLOAT | 1.000–2 | Scales the predicted ab colour channels before merging with L. 0.0 = grayscale passthrough, 1.0 = original model output, >1.0 = oversaturated colours. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The colourized image, same resolution as the input. Feed a Preview Image to see it. |