Step 1 – GAN class initialization

There are a few key things to notice in this initialization step, as shown here:

class GAN(object):
def __init__(self,discriminator,generator):
self.OPTIMIZER = Adam(lr=0.0002, decay=8e-9)
self.Generator = generator

self.Discriminator = discriminator
self.Discriminator.trainable = False

self.gan_model = self.model()
self.gan_model.compile(loss='binary_crossentropy',
optimizer=self.OPTIMIZER)
self.gan_model.summary()

First, notice that we are grabbing both the discriminator and generator models. The discriminator then sets its trainability to False, meaning that during the adversarial training, it will not be training. The generator is consistently getting better, but the discriminator will remain the same. In this architecture, this step is necessary so that it can converse. The model is then built and compiled. At the end, a summary is printed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.28.70