(self, channels, reduction=16)
| 140 | |
| 141 | class SEBlock(nn.Module): |
| 142 | def __init__(self, channels, reduction=16): |
| 143 | super().__init__() |
| 144 | self.squeeze = nn.AdaptiveAvgPool2d(1) |
| 145 | self.excitation = nn.Sequential( |
| 146 | nn.Linear(channels, channels // reduction, bias=False), |
| 147 | nn.ReLU(inplace=True), |
| 148 | nn.Linear(channels // reduction, channels, bias=False), |
| 149 | nn.Sigmoid() |
| 150 | ) |
| 151 | |
| 152 | def forward(self, x): |
| 153 | b, c, _, _ = x.size() |