Building the discriminator

The discriminator is really for the most part the same as any other CNN that I have previously talked about. Of course, there are a few new things that we should talk about. We will use the following code to build the discriminator:

def build_discriminator(img_shape):    input = Input(img_shape)    x =Conv2D(32, kernel_size=3, strides=2, padding="same")(input)    x = LeakyReLU(alpha=0.2)(x)    x = Dropout(0.25)(x)    x = Conv2D(64, kernel_size=3, strides=2, padding="same")(x)    x = ZeroPadding2D(padding=((0, 1), (0, 1)))(x)    x = (LeakyReLU(alpha=0.2))(x)    x = Dropout(0.25)(x)    x = BatchNormalization(momentum=0.8)(x)    x = Conv2D(128, kernel_size=3, strides=2, padding="same")(x)    x = LeakyReLU(alpha=0.2)(x)    x = Dropout(0.25)(x) x = BatchNormalization( ...

Get Deep Learning Quick Reference 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.