...

/

Training GAN for image inpainting

Training GAN for image inpainting

Understand the training process of GAN for image inpainting.

Now, it’s finally time to train a new GAN model for image inpainting. We can get the code from the original PyTorch implementationhttps://github.com/DAA233/generative-inpainting-pytorch. We will use the CelebA dataset as a training dataset for the experiment.

⚠️ The dataset is intended only for non-commercial research and educational use.

Model design for image inpainting

The GAN model for image inpainting consists of two generator networks (a coarse generator and a refinement generator) and two discriminator networks (a local discriminator and a global discriminator), as shown here:

Press + to interact
GAN model for image inpainting
GAN model for image inpainting

Image xx represents the input image, x1x_1 and x2x_2 represent generated images by coarse and refinement generators, respectively. xrx_r represents the original complete image and mm represents the mask for the missing part in the image.

The generator model uses a two-stage coarse-to-fine architecture. The coarse generator is a 17-layer encoder-decoder CNN, and dilated convolutions are used in the middle to expand the receptive fields. Assume that the size of the input image (xx) is 3×256×2563 \times 256 \times 256, then the output (x1x_1 ...