pretrained-models.pytorch icon indicating copy to clipboard operation
pretrained-models.pytorch copied to clipboard

Se resnext101 size mismatch

Open jaideep11061982 opened this issue 6 years ago • 1 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

jaideep11061982 avatar Aug 09 '19 09:08 jaideep11061982

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) https://github.com/Cadene/pretrained-models.pytorch/blob/021d97897c9aa76ec759deff43d341c4fd45d7ba/pretrainedmodels/models/senet.py#L323 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.

MamatShamshiev avatar Aug 16 '19 17:08 MamatShamshiev