Build a Pix2Pix GAN With Python
There are times that we want to transform an image into another style. Letโs say we have a fine collection of sketches. Our daily work is to colour these black and white images.
It might be interesting if the number of tasks is small, but when it comes to hundreds of sketches a day, hmmmโฆ maybe we need some help. This is where GAN comes to rescue. Generative Adversarial Network, or GAN, is a machine learning framework that aims to generate new data with the same distribution as the one in the training dataset. In this article, we will build a pix2pix GAN that takes an image as input, and later outputs another image.
To break things down, we will go through these steps:
- Prepare our data
- Build the network
- Train the network
- Test and see the results
Prepare our data
In image transformation, we need to have an original image and its expected transformed result. It is recommended to have more than thousands of this kind of before-after-pairs. (Yes, GAN needs a lot of image ๐ ) In this post, we will use data from this kaggle dataset.