Merge branch 'master' into main
commit
f92bd0be93
|
@ -242,13 +242,14 @@ class DetectionModel(BaseModel):
|
|||
# Build strides, anchors
|
||||
m = self.model[-1] # Detect()
|
||||
if isinstance(m, (Detect, Segment)):
|
||||
s = 256 # 2x min stride
|
||||
m.inplace = self.inplace
|
||||
|
||||
def forward(x):
|
||||
def _forward(x):
|
||||
"""Passes the input 'x' through the model and returns the processed output."""
|
||||
return self.forward(x)[0] if isinstance(m, Segment) else self.forward(x)
|
||||
|
||||
m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward
|
||||
s = 256 # 2x min stride
|
||||
m.inplace = self.inplace
|
||||
m.stride = torch.tensor([s / x.shape[-2] for x in _forward(torch.zeros(1, ch, s, s))]) # forward
|
||||
check_anchor_order(m)
|
||||
m.anchors /= m.stride.view(-1, 1, 1)
|
||||
self.stride = m.stride
|
||||
|
|
|
@ -23,6 +23,7 @@ try:
|
|||
except ImportError:
|
||||
|
||||
def SummaryWriter(*args):
|
||||
"""Fall back to SummaryWriter returning None if TensorBoard is not installed."""
|
||||
return None # None = SummaryWriter(str)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue