zero-mAP fix remove `torch.empty()` forward pass in `.train()` mode (#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>
pull/9066/head^2
0zppd 2022-08-21 18:40:28 +05:00 committed by GitHub
parent e6b4bf0bc2
commit 87e8deadd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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), [])