awsaf49 commited on
Commit
7b6938d
·
unverified ·
1 Parent(s): 9155eb8

Log best results (#6085)

Browse files

* log best result in summary

* comment added

* add space for `flake8`

* log `best/epoch`

* fix `dimension` for epoch

ValueError: all the input arrays must have same number of dimensions

* log `best/` in `utils.logger.__init__`

* fix pre-commit

1. missing whitespace around operator
2. over-indented

Files changed (1) hide show
  1. utils/loggers/__init__.py +5 -0
utils/loggers/__init__.py CHANGED
@@ -47,6 +47,7 @@ class Loggers():
47
  'metrics/precision', 'metrics/recall', 'metrics/mAP_0.5', 'metrics/mAP_0.5:0.95', # metrics
48
  'val/box_loss', 'val/obj_loss', 'val/cls_loss', # val loss
49
  'x/lr0', 'x/lr1', 'x/lr2'] # params
 
50
  for k in LOGGERS:
51
  setattr(self, k, None) # init empty logger dictionary
52
  self.csv = True # always log to csv
@@ -125,6 +126,10 @@ class Loggers():
125
  self.tb.add_scalar(k, v, epoch)
126
 
127
  if self.wandb:
 
 
 
 
128
  self.wandb.log(x)
129
  self.wandb.end_epoch(best_result=best_fitness == fi)
130
 
 
47
  'metrics/precision', 'metrics/recall', 'metrics/mAP_0.5', 'metrics/mAP_0.5:0.95', # metrics
48
  'val/box_loss', 'val/obj_loss', 'val/cls_loss', # val loss
49
  'x/lr0', 'x/lr1', 'x/lr2'] # params
50
+ self.best_keys = ['best/epoch', 'best/precision', 'best/recall', 'best/mAP_0.5', 'best/mAP_0.5:0.95',]
51
  for k in LOGGERS:
52
  setattr(self, k, None) # init empty logger dictionary
53
  self.csv = True # always log to csv
 
126
  self.tb.add_scalar(k, v, epoch)
127
 
128
  if self.wandb:
129
+ if best_fitness == fi:
130
+ best_results = [epoch] + vals[3:7]
131
+ for i, name in enumerate(self.best_keys):
132
+ self.wandb.wandb_run.summary[name] = best_results[i] # log best results in the summary
133
  self.wandb.log(x)
134
  self.wandb.end_epoch(best_result=best_fitness == fi)
135