Closed MccreeZhao closed 5 years ago
Yes, you are right about this. MaxPool2d is a mechiansm that I saw it in somewhere else. Actually, it has the same result with "if dim_match: self.shortcut_layer = None ", because when you do maxpool with kernel size 1*1, the feature map remains unchanged.
To prevent an ambiguity about this, I suggest you using the latter implementation.
Got it~Thanks for your reply
class BottleNeck_IR_SE(nn.Module): def init(self, in_channel, out_channel, stride): super(BottleNeck_IR_SE, self).init() if in_channel == out_channel: self.shortcut_layer = nn.MaxPool2d(1, stride) else: self.shortcut_layer = nn.Sequential( nn.Conv2d(in_channel, out_channel, kernel_size=(1, 1), stride=stride, bias=False), nn.BatchNorm2d(out_channel) ) I wonder why you use nn.MaxPool2d(1, stride) when in_channel == out_channel? I didn't find it in the raw ResNet and ArcFaceNet. I think there should be none like you write in the cbam.py:
if dim_match: self.shortcut_layer = None
Wating for your response and thanks a lot!