Skip to content

Commit

Permalink
Update callbacks.py with __init__() (ultralytics#5979)
Browse files Browse the repository at this point in the history
Add __init__() function.
  • Loading branch information
glenn-jocher committed Dec 14, 2021
1 parent 6bc585d commit 0a86a15
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions utils/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,32 @@ class Callbacks:
Handles all registered callbacks for YOLOv5 Hooks
"""

# Define the available callbacks
_callbacks = {
'on_pretrain_routine_start': [],
'on_pretrain_routine_end': [],
def __init__(self):
# Define the available callbacks
self._callbacks = {
'on_pretrain_routine_start': [],
'on_pretrain_routine_end': [],

'on_train_start': [],
'on_train_epoch_start': [],
'on_train_batch_start': [],
'optimizer_step': [],
'on_before_zero_grad': [],
'on_train_batch_end': [],
'on_train_epoch_end': [],
'on_train_start': [],
'on_train_epoch_start': [],
'on_train_batch_start': [],
'optimizer_step': [],
'on_before_zero_grad': [],
'on_train_batch_end': [],
'on_train_epoch_end': [],

'on_val_start': [],
'on_val_batch_start': [],
'on_val_image_end': [],
'on_val_batch_end': [],
'on_val_end': [],
'on_val_start': [],
'on_val_batch_start': [],
'on_val_image_end': [],
'on_val_batch_end': [],
'on_val_end': [],

'on_fit_epoch_end': [], # fit = train + val
'on_model_save': [],
'on_train_end': [],
'on_fit_epoch_end': [], # fit = train + val
'on_model_save': [],
'on_train_end': [],

'teardown': [],
}
'teardown': [],
}

def register_action(self, hook, name='', callback=None):
"""
Expand Down

0 comments on commit 0a86a15

Please sign in to comment.