tonylins / pytorch-mobilenet-v2

A PyTorch implementation of MobileNet V2 architecture and pretrained model.
Apache License 2.0
1.37k stars 328 forks source link

About the invert res-block module #3

Open hq-liu opened 6 years ago

hq-liu commented 6 years ago

Hi, I have a question about the invert res-block module in your code. When I implemented this model, I feel confused about how to build the invert res-block module. I found that in your code, you use this: self.use_res_connect = self.stride == 1 and inp == oup to ensure that input channels match with output channels. However, the input channels and output channels are always different. Thus, seems that there is no use for the this skip connection because (inp == oup) is always false. Hope you can reply this issue, thanks very match.

FatherOfHam commented 6 years ago

input channel and output channel are always the same.

tonylins commented 6 years ago

For each inverted residual sequence, input channel and output channel are the same except for the first layer.

hq-liu commented 6 years ago

I have already understood, thanks anyway

foreverYoungGitHub commented 6 years ago

But does this is same with the original paper?

The paper indicated that 'when input layer depth is 0 the underlying conv is the identity function.'

I'm just curious that whether the architecture should add an extra conv node for the first layer shortcut.

foreverYoungGitHub commented 6 years ago

The other thing is that, even though it is not indicated in the paper. But making the batch norm before the conv is possible to improve the accuracy. just like the resnet v2.