Created
August 20, 2019 16:32
-
-
Save dipanjanS/cd712ebaf84ada8ecfa498a595d2cd21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EpochModelSaver(keras.callbacks.Callback): | |
def on_epoch_end(self, epoch, logs={}): | |
self.model.save('vgg19_finetune_partial_seti_epoch_{}.h5'.format(epoch+1)) | |
ms_epoch = EpochModelSaver() | |
csv_logger = keras.callbacks.CSVLogger('vgg19_finetune_partial_seti_log.csv', append=True, separator=',') | |
history1 = model.fit_generator( | |
train_generator, | |
steps_per_epoch=math.ceil(5600 / TRAIN_BATCH_SIZE), | |
epochs=100, | |
validation_data=val_generator, | |
validation_steps=math.ceil(700 / VAL_BATCH_SIZE), | |
callbacks=[ms_epoch, csv_logger], verbose=1, | |
) | |
model.save('vgg19_finetune_partial_seti.h5') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment