This commit is contained in:
Glenn Jocher 2024-06-21 01:10:52 +02:00 committed by GitHub
parent ffb46fd7fb
commit ecfcdf12c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 21 additions and 18 deletions

View file

@ -789,7 +789,7 @@ class CIB(nn.Module):
self.cv1 = nn.Sequential(
Conv(c1, c1, 3, g=c1),
Conv(c1, 2 * c_, 1),
Conv(2 * c_, 2 * c_, 3, g=2 * c_) if not lk else RepVGGDW(2 * c_),
RepVGGDW(2 * c_) if lk else Conv(2 * c_, 2 * c_, 3, g=2 * c_),
Conv(2 * c_, c2, 1),
Conv(c2, c2, 3, g=c2),
)

View file

@ -110,8 +110,7 @@ class Detect(nn.Module):
else:
dbox = self.decode_bboxes(self.dfl(box), self.anchors.unsqueeze(0)) * self.strides
y = torch.cat((dbox, cls.sigmoid()), 1)
return y
return torch.cat((dbox, cls.sigmoid()), 1)
def bias_init(self):
"""Initialize Detect() biases, WARNING: requires stride availability."""

View file

@ -693,7 +693,7 @@ class Ensemble(nn.ModuleList):
@contextlib.contextmanager
def temporary_modules(modules={}, attributes={}):
def temporary_modules(modules=None, attributes=None):
"""
Context manager for temporarily adding or modifying modules in Python's module cache (`sys.modules`).
@ -718,6 +718,10 @@ def temporary_modules(modules={}, attributes={}):
applications or libraries. Use this function with caution.
"""
if modules is None:
modules = {}
if attributes is None:
attributes = {}
import sys
from importlib import import_module