From 646386ff09f8fce34cb8665a99dfd523f2dc138c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 24 Apr 2021 00:10:38 +0200 Subject: [PATCH] Update export.py for 2 dry runs (#2910) * Update export.py for 2 dry runs * Update export.py --- models/export.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/export.py b/models/export.py index 5b7b6bda08ae..a820ff94ac17 100644 --- a/models/export.py +++ b/models/export.py @@ -58,7 +58,8 @@ # elif isinstance(m, models.yolo.Detect): # m.forward = m.forward_export # assign forward (optional) model.model[-1].export = not opt.grid # set Detect() layer grid export - y = model(img) # dry run + for _ in range(2): + y = model(img) # dry runs # TorchScript export ----------------------------------------------------------------------------------------------- prefix = colorstr('TorchScript:') @@ -80,7 +81,6 @@ print(f'{prefix} starting export with onnx {onnx.__version__}...') f = opt.weights.replace('.pt', '.onnx') # filename torch.onnx.export(model, img, f, verbose=False, opset_version=12, input_names=['images'], - output_names=['classes', 'boxes'] if y is None else ['output'], dynamic_axes={'images': {0: 'batch', 2: 'height', 3: 'width'}, # size(1,3,640,640) 'output': {0: 'batch', 2: 'y', 3: 'x'}} if opt.dynamic else None)