Cadene / pretrained-models.pytorch

Pretrained ConvNets for pytorch: NASNet, ResNeXt, ResNet, InceptionV4, InceptionResnetV2, Xception, DPN, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Se resnext101 size mismatch

jaideep11061982 opened this issue · comments

Hi i get a size mismatch issue for se resnext 101 32 x4d
I changed the classes to 1 from 1000.

size mismatch, m1: [80 x 8192], m2: [2048 x 1] at /opt/conda/conda-bld/pytorch_1556653099582/work/aten/src/THC/generic/THCTensorMathBlas.cu:268

Probably shape of your input differs from (3, 224, 224). As far as I understand, In implementation of SENet 2D average pooling is used (not global average pooling)

self.avg_pool = nn.AvgPool2d(7, stride=1)

That's why the mismatch happens in case of images of different shape.
You may change self.avg_pool attribute to nn.AdaptiveAvgPool2d((1, 1)) and it probably should work.