Skip to content

Instantly share code, notes, and snippets.

@jonathanoheix
Created January 4, 2019 08:28
Show Gist options
  • Save jonathanoheix/2e7a7d05096c15c0a09961b7ca73cfc6 to your computer and use it in GitHub Desktop.
Save jonathanoheix/2e7a7d05096c15c0a09961b7ca73cfc6 to your computer and use it in GitHub Desktop.
# number of epochs to train the NN
epochs = 50
from keras.callbacks import ModelCheckpoint
checkpoint = ModelCheckpoint("model_weights.h5", monitor='val_acc', verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]
history = model.fit_generator(generator=train_generator,
steps_per_epoch=train_generator.n//train_generator.batch_size,
epochs=epochs,
validation_data = validation_generator,
validation_steps = validation_generator.n//validation_generator.batch_size,
callbacks=callbacks_list
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment