MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / Bottleneck

Class Bottleneck

yolox/models/network_blocks.py:79–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79class Bottleneck(nn.Module):
80 # Standard bottleneck
81 def __init__(
82 self,
83 in_channels,
84 out_channels,
85 shortcut=True,
86 expansion=0.5,
87 depthwise=False,
88 act="silu",
89 ):
90 super().__init__()
91 hidden_channels = int(out_channels * expansion)
92 Conv = DWConv if depthwise else BaseConv
93 self.conv1 = BaseConv(in_channels, hidden_channels, 1, stride=1, act=act)
94 self.conv2 = Conv(hidden_channels, out_channels, 3, stride=1, act=act)
95 self.use_add = shortcut and in_channels == out_channels
96
97 def forward(self, x):
98 y = self.conv2(self.conv1(x))
99 if self.use_add:
100 y = y + x
101 return y
102
103
104class ResLayer(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected