ChannelAttention, SpatialAttention, and SEAttention代码
classChannelAttention(nn.Module):def__init__(self,channel,reduction=16):super().__init__()self.maxpool=nn.AdaptiveMaxPool2d(1)self.avgpool=nn.AdaptiveAvgPool2d(1)self.se=nn.Sequential(nn.Conv2d(channe