We created a custom class GAN, which is initialized with a generator and a discriminator. The steps followed are listed in the following points:
- Initialize the variables img_rows, img_cols, channels, img_shape, and latent_dim
- Initialize the optimizer; we are using the Adam optimizer in this case
- Instantiate the discriminator:
- Use build_discriminator()
- Compile the discriminator with the loss function as binary_crossentropy, the optimizer as Adam, and the metrics as accuracy
- Generator:
- Instantiate using build_generator()
- Get the generated image with noise as the input
- Discriminator checks the validity of the images
- Combined model: Used to fool the discriminator with the generator:
- z with input shape (*, self.latent_dim) ...