Skip to content

Commit

Permalink
TensorBoard add_graph() fix (ultralytics#3236)
Browse files Browse the repository at this point in the history
(cherry picked from commit b7cd1f5)
  • Loading branch information
glenn-jocher authored and Lechtr committed May 24, 2021
1 parent 1967a2a commit 272477b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ def train(hyp, opt, device, tb_writer=None):
if plots and ni < 3:
f = save_dir / f'train_batch{ni}.jpg' # filename
Thread(target=plot_images, args=(imgs, targets, paths, f), daemon=True).start()
# if tb_writer:
# tb_writer.add_image(f, result, dataformats='HWC', global_step=epoch)
# tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), []) # add model graph
if tb_writer:
tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), []) # add model graph
# tb_writer.add_image(f, result, dataformats='HWC', global_step=epoch)
elif plots and ni == 10 and wandb_logger.wandb:
wandb_logger.log({"Mosaics": [wandb_logger.wandb.Image(str(x), caption=x.name) for x in
save_dir.glob('train*.jpg') if x.exists()]})
Expand Down

0 comments on commit 272477b

Please sign in to comment.