Helper functions

At the end of each of these classes, we need to insert helper functions to complete simple functionality, such as displaying a summary, saving a model file, and saving a model graphic.

To add this functionality to the Discriminator class, take the following steps:

  1. Add a definition in the Discriminator class called summary, which will display the model summary as follows:
def summary(self):
return self.Discriminator.summary()
  1. The following helper function allows us to save the model with a variable for epoch and batch:
def save_model(self,epoch,batch):
self.Discriminator.save('/out/'+self.NAME+'_Epoch_'+epoch+'_Batch_'+batch+'model.h5')
  1. Insert a save_model_graph function as follows. This will be called with every discriminator object that's instantiated:
def save_model_graph(self):
plot_model(self.Discriminator, to_file='/data/Discriminator_Model.png')
..................Content has been hidden....................

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