Colorization
Automatic colorization of grayscale images using a CNN trained on ImageNet. Based on the paper: Colorful Image Colorization by Richard Zhang, Phillip Isola, Alexei A. Efros (ECCV 2016).
The network takes the L channel of a LAB image as input and predicts the ab channels, which are then merged back with L to produce a full-color output.
Model Details
- Architecture: Custom CNN (VGG-style encoder + dilated convolutions)
- Input: Grayscale image (L channel of LAB), 224×224
- Output: ab channels, upsampled to original size
- Framework: ONNX (converted from original Caffe model)
- Original weights: http://eecs.berkeley.edu/~rich.zhang/projects/2016_colorization/
Usage
Python
python demo.py --model colorization_deploy_v2_2026april.onnx --image example_outputs/input_image.jpg --output example_outputs/output_image.png
Or import directly:
import cv2
net = cv2.dnn.readNet("colorization_deploy_v2_2026apr.onnx")
# see demo.py for full inference pipeline
License
See LICENSE — original model is released under BSD license by Richard Zhang.
References
- Paper: https://arxiv.org/abs/1603.08511
- Original repo: https://github.com/richzhang/colorization