diff --git a/export.py b/export.py index 1bb7ded8a..0f26e63e9 100644 --- a/export.py +++ b/export.py @@ -489,7 +489,7 @@ def run( for k, m in model.named_modules(): if isinstance(m, Detect): m.inplace = inplace - m.onnx_dynamic = dynamic + m.dynamic = dynamic m.export = True for _ in range(2): diff --git a/models/yolo.py b/models/yolo.py index e154b7268..7a7308312 100644 --- a/models/yolo.py +++ b/models/yolo.py @@ -37,7 +37,7 @@ except ImportError: class Detect(nn.Module): stride = None # strides computed during build - onnx_dynamic = False # ONNX export parameter + dynamic = False # force grid reconstruction export = False # export mode def __init__(self, nc=80, anchors=(), ch=(), inplace=True): # detection layer @@ -60,7 +60,7 @@ class Detect(nn.Module): x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous() if not self.training: # inference - if self.onnx_dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]: + if self.dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]: self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i) y = x[i].sigmoid()