From 602d7ffb0e8667c63bd0007ecf3cfd29a46f9cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Busche?= Date: Thu, 21 Jul 2022 17:40:53 +0200 Subject: [PATCH] Check TensorBoard logger before adding graph (#8664) Otherwise, an error is thrown if the tensorboard logger is not included. --- utils/loggers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/loggers/__init__.py b/utils/loggers/__init__.py index 42b696ba644f..88bdb0521619 100644 --- a/utils/loggers/__init__.py +++ b/utils/loggers/__init__.py @@ -102,7 +102,7 @@ def on_train_batch_end(self, ni, model, imgs, targets, paths, plots): # Callback runs on train batch end if plots: if ni == 0: - if not self.opt.sync_bn: # --sync known issue https://github.com/ultralytics/yolov5/issues/3754 + if self.tb and not self.opt.sync_bn: # --sync known issue https://github.com/ultralytics/yolov5/issues/3754 with warnings.catch_warnings(): warnings.simplefilter('ignore') # suppress jit trace warning self.tb.add_graph(torch.jit.trace(de_parallel(model), imgs[0:1], strict=False), [])