October 2018
Intermediate to advanced
252 pages
6h 49m
English
In this section, we look at how we create a combined model, which is a combination of generator and discriminator, to make the generator better. The following code is in the __init__(self) function:
def __init__(self): .... optimizer = Adam(0.0002, 0.5) # Build and compile the discriminator self.discriminator = self.build_discriminator() self.discriminator.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['accuracy']) # Build the generator self.generator = self.build_generator() # The generator takes noise as input and generates imgs z = Input(shape=(100,)) img = self.generator(z) # For the combined model we will only train the generator self.discriminator.trainable = False # The ...
Read now
Unlock full access