There are a few helper methods that enable you to understand key information about the structures you are developing:
- The first method called summary will print the summary that's available from Keras of the model you produced previously:
def summary(self):
return self.Discriminator.summary()
The summary function should put out data just like this on the Terminal:
Layer (type) Output Shape Param #
=================================================================
flatten_1 (Flatten) (None, 784) 0
_________________________________________________________________
dense_6 (Dense) (None, 784) 615440
_________________________________________________________________
leaky_re_lu_5 (LeakyReLU) (None, 784) 0
_________________________________________________________________
dense_7 (Dense) (None, 392) 307720
_________________________________________________________________
leaky_re_lu_6 (LeakyReLU) (None, 392) 0
_________________________________________________________________
dense_8 (Dense) (None, 1) 393
=================================================================
Total params: 923,553
Trainable params: 923,553
Non-trainable params: 0
_________________________________________________________________
- Our next helper function, called save_model , produces the photographic version of the model structure:
def save_model(self):
plot_model(self.Discriminator.model,
to_file='/data/Discriminator_Model.png')
The output of the save model function will save an image just like this to the data folder:
Hence, you have now understood how to build your first GAN discriminator.