Closed kaylode closed 2 years ago
For example:
Source: tensorflow - keras
class CustomCallback(keras.callbacks.Callback): def on_train_begin(self, logs=None): keys = list(logs.keys()) print("Starting training; got log keys: {}".format(keys)) def on_train_end(self, logs=None): keys = list(logs.keys()) print("Stop training; got log keys: {}".format(keys)) def on_epoch_begin(self, epoch, logs=None): keys = list(logs.keys()) print("Start epoch {} of training; got log keys: {}".format(epoch, keys)) def on_epoch_end(self, epoch, logs=None): keys = list(logs.keys()) print("End epoch {} of training; got log keys: {}".format(epoch, keys))
trainer = ClassificationTrainer(..., callbacks = List[Callbacks])
https://github.com/keras-team/keras/blob/v2.8.0/keras/callbacks.py#L650-L653
https://github.com/ultralytics/yolov5/blob/e6e36aac109794999f1dafab244b9ec4887a33d1/utils/callbacks.py#L7
For example:
Source: tensorflow - keras