mobilenetv3 icon indicating copy to clipboard operation
mobilenetv3 copied to clipboard

Why do you use conv and bn in SeModule?

Open kuan-wang opened this issue 5 years ago • 3 comments

Your SEModule is different from what the paper claimed. You can change it refer to https://github.com/moskomule/senet.pytorch/blob/master/senet/se_module.py or my impementation https://github.com/kuan-wang/pytorch-mobilenet-v3/blob/master/mobilenetv3.py.

kuan-wang avatar May 14 '19 15:05 kuan-wang

Sorry, it's my fault to do so, I have retrain it, new model mbv3_small also get top-1 69.037, I have updated it.

xiaolai-sqlai avatar May 26 '19 05:05 xiaolai-sqlai

hi, it is a mistake in se module that use nn.Conv2d instead of nn.Linear:

 self.se = nn.Sequential(
            nn.AdaptiveAvgPool2d(1),
            nn.Conv2d(in_size, in_size // reduction, kernel_size=1, stride=1, padding=0, bias=False),
            nn.BatchNorm2d(in_size // reduction),
            nn.ReLU(inplace=True),
            nn.Conv2d(in_size // reduction, in_size, kernel_size=1, stride=1, padding=0, bias=False),
            nn.BatchNorm2d(in_size),
            hsigmoid()
        )

when I convert this model to caffe version, I got a error like this:

F1015 11:07:24.302090  4099 eltwise_layer.cpp:34] Check failed: bottom[0]->shape() == bottom[i]->shape() bottom[0]: 1 16 56 56 (50176), bottom[1]: 1 16 1 1 (16)

maybe it can get a bottom: 1 16 (16) with nn.Linear in pytorch version which successfully achieve Operation x * self.se(x) in SeModule.

Dawson-huang avatar Oct 15 '19 03:10 Dawson-huang

Yes. When batch_size = 1, an error will be reported here. issues

zihaozhang9 avatar Dec 27 '19 05:12 zihaozhang9