There are two components within GANs – the generator and the discriminator. We start by creating individual generator and discriminator networks first, followed by chaining these two networks through a GAN model and training it. Let's get started:
- Since we are dealing with grayscale images, the number of channels will be 1. We also set the dimension of our random noise vector, which is used as input for the generator network, to 100:
channels <- 1set.seed(10)latent_dimension <- 100
- Next, we create the generator network. The generator network maps random normal noise vectors of shape latent_dimension to a vector of length equal to the flattened input image. The generator network consists of three hidden layers; the ...