wujiyang / Face_Pytorch

face recognition algorithms in pytorch framework, including arcface, cosface, sphereface and so on
Apache License 2.0
808 stars 156 forks source link

Question about ArcFaceNet #11

Closed MccreeZhao closed 5 years ago

MccreeZhao commented 5 years ago

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!

wujiyang commented 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.

MccreeZhao commented 5 years ago

Got it~Thanks for your reply