Imagine a scenario where you are given a bunch of black-and-white images and are asked to turn them into color images. How would you solve this problem? One way to solve this is by using a pseudo-supervised pipeline where we take a raw image, convert it into black and white, and treat them as input-output pairs. We will demonstrate this by leveraging the CIFAR-10 dataset to perform colorization on images.
The strategy that we will adopt as we code up the image colorization network is as follows:
- Take the original color image in the training dataset and convert it into grayscale to fetch the input (grayscale) and output (original colored image) combination.
- Normalize the input and output.
- Build a U-Net architecture.
- Train the model over increasing epochs.
With the preceding strategy in place, let's go ahead and code up the model as follows:
The following code is available as Image colorization.ipynb in the Chapter 10 folder of this book's GitHub repository...