Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Last active May 27, 2019 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/c40cc2a2fcfd490e8be0575afc4c3c80 to your computer and use it in GitHub Desktop.
Save frogermcs/c40cc2a2fcfd490e8be0575afc4c3c80 to your computer and use it in GitHub Desktop.
steps_per_epoch = np.ceil(train_generator.samples/train_generator.batch_size)
val_steps_per_epoch = np.ceil(valid_generator.samples/valid_generator.batch_size)
hist = model.fit(
train_generator,
epochs=10,
verbose=1,
steps_per_epoch=steps_per_epoch,
validation_data=valid_generator,
validation_steps=val_steps_per_epoch).history
# Measure accuracy and loss after training
final_loss, final_accuracy = model.evaluate(valid_generator, steps = val_steps_per_epoch)
print("Final loss: {:.2f}".format(final_loss))
print("Final accuracy: {:.2f}%".format(final_accuracy * 100))
# >> Final loss: 0.44
# >> Final accuracy: 87.41%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment