Check TensorBoard logger before adding graph (#8664)

Otherwise, an error is thrown if the tensorboard logger is not included.
This commit is contained in:
Rüdiger Busche authored and GitHub committed 2022-07-21 17:40:53 +02:00
1 parent 92e47b85d9
commit 602d7ffb0e
1 file changed
+1 -1
+1 -1
View File
@@ -102,7 +102,7 @@ class Loggers():
# 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), [])