Skip to content

Instantly share code, notes, and snippets.

@algonacci
Created June 14, 2022 10:40
Show Gist options
  • Select an option

  • Save algonacci/8673020bee3d9251c0fd9beabe46e3ba to your computer and use it in GitHub Desktop.

Select an option

Save algonacci/8673020bee3d9251c0fd9beabe46e3ba to your computer and use it in GitHub Desktop.
A script to make a callback on training
class myCallback(tf.keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
if logs.get('accuracy') is not None and logs.get('val_accuracy') > 0.85:
print("\nReached 85% validation accuracy so cancelling training!")
self.model.stop_training = True
callback = myCallback()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment