Add missing Python function docstrings (#13105)
* Add missing Python function docstrings * Auto-format by https://ultralytics.com/actions --------- Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>pull/13112/head
parent
cf8933caca
commit
ec331cbda7
|
@ -242,13 +242,14 @@ class DetectionModel(BaseModel):
|
||||||
# Build strides, anchors
|
# Build strides, anchors
|
||||||
m = self.model[-1] # Detect()
|
m = self.model[-1] # Detect()
|
||||||
if isinstance(m, (Detect, Segment)):
|
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)
|
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)
|
check_anchor_order(m)
|
||||||
m.anchors /= m.stride.view(-1, 1, 1)
|
m.anchors /= m.stride.view(-1, 1, 1)
|
||||||
self.stride = m.stride
|
self.stride = m.stride
|
||||||
|
|
|
@ -23,6 +23,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
def SummaryWriter(*args):
|
def SummaryWriter(*args):
|
||||||
|
"""Fall back to SummaryWriter returning None if TensorBoard is not installed."""
|
||||||
return None # None = SummaryWriter(str)
|
return None # None = SummaryWriter(str)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue