| 234 | |
| 235 | |
| 236 | class CBAM(nn.Module): |
| 237 | def __init__(self, channel): |
| 238 | super(CBAM, self).__init__() |
| 239 | self.channel_attention = ChannelAttentionModule(channel) |
| 240 | self.spatial_attention = SpatialAttentionModule() |
| 241 | |
| 242 | def forward(self, x): |
| 243 | out = self.channel_attention(x) * x |
| 244 | out = self.spatial_attention(out) * out |
| 245 | return out |
| 246 | |
| 247 | |
| 248 | class InterFA(nn.Module): |