| 98 | x=x*atten |
| 99 | return x |
| 100 | class FeatureSelectionModule(nn.Module): |
| 101 | # FaPN paper |
| 102 | def __init__(self, in_chan, out_chan): |
| 103 | super(FeatureSelectionModule, self).__init__() |
| 104 | self.conv_atten=nn.Sequential( |
| 105 | nn.AdaptiveAvgPool2d(1), |
| 106 | nn.Conv2d(in_chan, in_chan, kernel_size=1, bias=False), |
| 107 | nn.Sigmoid() |
| 108 | ) |
| 109 | self.conv = nn.Conv2d(in_chan, out_chan, kernel_size=1, bias=False) |
| 110 | |
| 111 | def forward(self, x): |
| 112 | x = x*self.conv_atten(x) + x |
| 113 | x = self.conv(x) |
| 114 | return x |
| 115 | |
| 116 | class DeformConv(nn.Module): |
| 117 | def __init__(self,in_channels, out_channels, kernel_size, stride, padding, dilation=1, deformable_groups=1): |