| 82 | x= self.se(x)+x |
| 83 | return x |
| 84 | class AttentionRefinementModule(nn.Module): |
| 85 | def __init__(self, in_chan, out_chan): |
| 86 | super(AttentionRefinementModule, self).__init__() |
| 87 | self.conv=ConvBnAct(in_chan,out_chan,3,1,1) |
| 88 | self.scale = nn.Sequential( |
| 89 | nn.AdaptiveAvgPool2d(1), |
| 90 | nn.Conv2d(out_chan, out_chan, 1, bias=False), |
| 91 | nn.BatchNorm2d(out_chan), |
| 92 | nn.Sigmoid(), |
| 93 | ) |
| 94 | |
| 95 | def forward(self, x): |
| 96 | x = self.conv(x) |
| 97 | atten=self.scale(x) |
| 98 | x=x*atten |
| 99 | return x |
| 100 | class FeatureSelectionModule(nn.Module): |
| 101 | # FaPN paper |
| 102 | def __init__(self, in_chan, out_chan): |