Go ahead and download the source code, model, and example images using the “Downloads” section of this post. To produce more plausible black and white image colorizations the authors also utilize a few additional techniques including mean annealing and a specialized loss function for color rebalancing (both of which are outside the scope of this post).įor more details on the image colorization algorithm and deep learning model, be sure to refer to the official publication of Zhang et al. Combine the input L channel with the predicted ab channels.Use the L channel as the input to the network and train the network to predict the ab channels.Convert all training images from the RGB color space to the Lab color space.The entire (simplified) process can be summarized as: Given the input L channel and the predicted ab channels we can then form our final output image. Since the L channel encodes only the intensity, we can use the L channel as our grayscale input to the network.įrom there the network must learn to predict the a and b channels.
Previous approaches to black and white image colorization relied on manual human annotation and often produced desaturated results that were not “believable” as true colorizations. The technique we’ll be covering here today is from Zhang et al.’s 2016 ECCV paper, Colorful Image Colorization. How can we colorize black and white images with deep learning? Figure 1: Zhang et al.’s architecture for colorization of black and white images with deep learning.
We’ll then explore some examples and demos of our work. In the first part of this tutorial, we’ll discuss how deep learning can be utilized to colorize black and white images.įrom there we’ll utilize OpenCV to colorize black and white images for both:
Looking for the source code to this post? Jump Right To The Downloads Section Black and white image colorization with OpenCV and Deep Learning