tensorfreitas / DCGAN-for-Bird-Generation

DCGAN and WGAN implementation on Keras for Bird Generation
65 stars 22 forks source link

Implement resume #5

Closed Ianmcmill closed 5 years ago

Ianmcmill commented 6 years ago

Hi there! Thanks for your code. I am currently learning python and keras and found your implementation as just what I wanted to get into it. I am trying to implement loading of models. Your implementation saves thes whole model in hdf5 format. I have searched through documentation about loading models back in found this

from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
del model  # deletes the existing model

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')

Now I am a Python beginner. Bloody beginner. I know that I should implement some argument handling for let's say batch_size, epochs, output_size, graph_plot and of course checkpoint directory so that the training can be resumed. My problem is is don't know how. I studied carpedm's DCGAN for Tensorflow but I'm not able to transfer the load handling. Any help would be greatly appreciated!

tensorfreitas commented 6 years ago

The saving and load of the model are exactly like you described! The extension of the model file is just different.

To change some of these arguments you can use the variables used under main function and edit those values (bare in mind that if you edit the image size that will probably will need you to change the model architecture).

Hope I was able to help you!