关于decoder的设计方法,还有两个可以参考的小技巧:一是 Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks,可以理解为是一种attention,用很少的参数来校准feature map,详情请见论文,但实现细节可参考以下的PyTorch代码:
class sSE(nn.Module):
def __init__(self, out_channels):
super(sSE, self).__init__()
self.conv = ConvBn2d(in_channels=out_channels,out_channels=1,kernel_size=1,padding=0)
def forward(self,x):
x=self.conv(x)
#print('spatial',x.size())
x=F.sigmoid(x)
return x
class cSE(nn.Module):
def __init__(self, out_channels):
super(cSE, self).__init__()
self.conv1 = ConvBn2d(in_channels=out_channels,out_channels=int(out_channels/2),kernel_size=1,padding=0)
self.conv2 = ConvBn2d(in_channels=int(out_channels/2),out_channels=out_channels