Janko Ondras commited on
Commit
e558963
·
1 Parent(s): e169edf

Log hyperparameters in tensorboard

Browse files

Log both hyperparameters and command line options in tensorboard.

Files changed (1) hide show
  1. train.py +8 -0
train.py CHANGED
@@ -58,6 +58,14 @@ def train(hyp):
58
  with open(Path(log_dir) / 'opt.yaml', 'w') as f:
59
  yaml.dump(vars(opt), f, sort_keys=False)
60
 
 
 
 
 
 
 
 
 
61
  epochs = opt.epochs # 300
62
  batch_size = opt.batch_size # 64
63
  weights = opt.weights # initial training weights
 
58
  with open(Path(log_dir) / 'opt.yaml', 'w') as f:
59
  yaml.dump(vars(opt), f, sort_keys=False)
60
 
61
+ # Log hyperparameters in tensorboard
62
+ if tb_writer:
63
+ tb_hparams_dict = hyp
64
+ tb_hparams_dict.update(vars(opt))
65
+ tb_hparams_dict['img_size_w'], tb_hparams_dict['img_size_h'] = tb_hparams_dict['img_size']
66
+ del tb_hparams_dict['img_size']
67
+ tb_writer.add_hparams(tb_hparams_dict, {})
68
+
69
  epochs = opt.epochs # 300
70
  batch_size = opt.batch_size # 64
71
  weights = opt.weights # initial training weights