The discriminator network

The discriminator network is inspired by the architecture of PatchGAN. It contains eight convolutional blocks, a dense layer, and a flatten layer. The discriminator network takes a set of patches extracted from an image of a dimension of (256, 256, 1) and predicts the probability of the given patches. Let's implement the discriminator in Keras. 

  1. Start by initializing the hyperparameters required for the generator network:
kernel_size = 4strides = 2leakyrelu_alpha = 0.2padding = 'same'num_filters_start = 64  # Number of filters to start withnum_kernels = 100kernel_dim = 5patchgan_output_dim = (256, 256, 1)patchgan_patch_dim = (256, 256, 1)# Calculate number of patchesnumber_patches = int((patchgan_output_dim[0] / ...

Get Generative Adversarial Networks Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.