Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 21, 2019 15:44
Show Gist options
  • Select an option

  • Save dipanjanS/d35e60f86ebb1b03c31bdbfccd97bc63 to your computer and use it in GitHub Desktop.

Select an option

Save dipanjanS/d35e60f86ebb1b03c31bdbfccd97bc63 to your computer and use it in GitHub Desktop.
class EpochModelSaver(keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
self.model.save('resnet50_finetune_full_seti_epoch_{}.h5'.format(epoch+1))
ms_epoch = EpochModelSaver()
csv_logger = keras.callbacks.CSVLogger('resnet50_finetune_full_seti_log.csv', append=True, separator=',')
history3 = model.fit_generator(
train_generator,
steps_per_epoch=math.ceil(5600 / TRAIN_BATCH_SIZE),
epochs=500,
validation_data=val_generator,
validation_steps=math.ceil(700 / VAL_BATCH_SIZE),
callbacks=[ms_epoch, csv_logger], verbose=1,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment