mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
Rename onnx_dynamic -> dynamic (#9168)
This commit is contained in:
parent
f2b8f3fe3a
commit
85d7ae2195
@ -489,7 +489,7 @@ def run(
|
|||||||
for k, m in model.named_modules():
|
for k, m in model.named_modules():
|
||||||
if isinstance(m, Detect):
|
if isinstance(m, Detect):
|
||||||
m.inplace = inplace
|
m.inplace = inplace
|
||||||
m.onnx_dynamic = dynamic
|
m.dynamic = dynamic
|
||||||
m.export = True
|
m.export = True
|
||||||
|
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
|
@ -37,7 +37,7 @@ except ImportError:
|
|||||||
|
|
||||||
class Detect(nn.Module):
|
class Detect(nn.Module):
|
||||||
stride = None # strides computed during build
|
stride = None # strides computed during build
|
||||||
onnx_dynamic = False # ONNX export parameter
|
dynamic = False # force grid reconstruction
|
||||||
export = False # export mode
|
export = False # export mode
|
||||||
|
|
||||||
def __init__(self, nc=80, anchors=(), ch=(), inplace=True): # detection layer
|
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()
|
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 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)
|
self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i)
|
||||||
|
|
||||||
y = x[i].sigmoid()
|
y = x[i].sigmoid()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user