Skip to content

Commit

Permalink
zero-mAP fix remove torch.empty() forward pass in .train() mode (u…
Browse files Browse the repository at this point in the history
…ltralytics#9068)

* Fix Zero Map Issue

Signed-off-by: 0zppd <111682241+0zppd@users.noreply.github.com>

* Update __init__.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: 0zppd <111682241+0zppd@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
2 people authored and Clay Januhowski committed Sep 8, 2022
1 parent 6557a0c commit 1eae290
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def log_tensorboard_graph(tb, model, imgsz=(640, 640)):
try:
p = next(model.parameters()) # for device, type
imgsz = (imgsz, imgsz) if isinstance(imgsz, int) else imgsz # expand
im = torch.empty((1, 3, *imgsz)).to(p.device).type_as(p) # input image
im = torch.zeros((1, 3, *imgsz)).to(p.device).type_as(p) # input image (WARNING: must be zeros, not empty)
with warnings.catch_warnings():
warnings.simplefilter('ignore') # suppress jit trace warning
tb.add_graph(torch.jit.trace(de_parallel(model), im, strict=False), [])
Expand Down

0 comments on commit 1eae290

Please sign in to comment.