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
parent
e6b4bf0bc2
commit
87e8deadd5
|
@ -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), [])
|
||||
|
|
Loading…
Reference in New Issue