glenn-jocher commited on
Commit
c9a46a6
·
unverified ·
1 Parent(s): d699c21

Update callbacks.py with `__init__()` (#5979)

Browse files
Files changed (1) hide show
  1. utils/callbacks.py +22 -21
utils/callbacks.py CHANGED
@@ -9,31 +9,32 @@ class Callbacks:
9
  Handles all registered callbacks for YOLOv5 Hooks
10
  """
11
 
12
- # Define the available callbacks
13
- _callbacks = {
14
- 'on_pretrain_routine_start': [],
15
- 'on_pretrain_routine_end': [],
 
16
 
17
- 'on_train_start': [],
18
- 'on_train_epoch_start': [],
19
- 'on_train_batch_start': [],
20
- 'optimizer_step': [],
21
- 'on_before_zero_grad': [],
22
- 'on_train_batch_end': [],
23
- 'on_train_epoch_end': [],
24
 
25
- 'on_val_start': [],
26
- 'on_val_batch_start': [],
27
- 'on_val_image_end': [],
28
- 'on_val_batch_end': [],
29
- 'on_val_end': [],
30
 
31
- 'on_fit_epoch_end': [], # fit = train + val
32
- 'on_model_save': [],
33
- 'on_train_end': [],
34
 
35
- 'teardown': [],
36
- }
37
 
38
  def register_action(self, hook, name='', callback=None):
39
  """
 
9
  Handles all registered callbacks for YOLOv5 Hooks
10
  """
11
 
12
+ def __init__(self):
13
+ # Define the available callbacks
14
+ self._callbacks = {
15
+ 'on_pretrain_routine_start': [],
16
+ 'on_pretrain_routine_end': [],
17
 
18
+ 'on_train_start': [],
19
+ 'on_train_epoch_start': [],
20
+ 'on_train_batch_start': [],
21
+ 'optimizer_step': [],
22
+ 'on_before_zero_grad': [],
23
+ 'on_train_batch_end': [],
24
+ 'on_train_epoch_end': [],
25
 
26
+ 'on_val_start': [],
27
+ 'on_val_batch_start': [],
28
+ 'on_val_image_end': [],
29
+ 'on_val_batch_end': [],
30
+ 'on_val_end': [],
31
 
32
+ 'on_fit_epoch_end': [], # fit = train + val
33
+ 'on_model_save': [],
34
+ 'on_train_end': [],
35
 
36
+ 'teardown': [],
37
+ }
38
 
39
  def register_action(self, hook, name='', callback=None):
40
  """