ultralytics 8.2.35 add YOLOv9t/s/m models (#13504)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Laughing 2024-06-18 00:53:19 +08:00 committed by GitHub
parent 605e7f4f52
commit 8ea945cc8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 168 additions and 8 deletions

View file

@ -32,7 +32,9 @@ __all__ = (
"RepC3",
"ResNetLayer",
"RepNCSPELAN4",
"ELAN1",
"ADown",
"AConv",
"SPPELAN",
"CBFuse",
"CBLinear",
@ -603,6 +605,33 @@ class RepNCSPELAN4(nn.Module):
return self.cv4(torch.cat(y, 1))
class ELAN1(RepNCSPELAN4):
"""ELAN1 module with 4 convolutions."""
def __init__(self, c1, c2, c3, c4):
"""Initializes ELAN1 layer with specified channel sizes."""
super().__init__(c1, c2, c3, c4)
self.c = c3 // 2
self.cv1 = Conv(c1, c3, 1, 1)
self.cv2 = Conv(c3 // 2, c4, 3, 1)
self.cv3 = Conv(c4, c4, 3, 1)
self.cv4 = Conv(c3 + (2 * c4), c2, 1, 1)
class AConv(nn.Module):
"""AConv."""
def __init__(self, c1, c2):
"""Initializes AConv module with convolution layers."""
super().__init__()
self.cv1 = Conv(c1, c2, 3, 2, 1)
def forward(self, x):
"""Forward pass through AConv layer."""
x = torch.nn.functional.avg_pool2d(x, 2, 1, 0, False, True)
return self.cv1(x)
class ADown(nn.Module):
"""ADown."""