EMSANet icon indicating copy to clipboard operation
EMSANet copied to clipboard

Loading pre-trained resnet50

Open thom966 opened this issue 1 year ago • 1 comments

I have a question regarding loading a ResNet model other than ResNet-34. I tried to use ResNet-50 with the pre-trained weights provided by PyTorch, but the ResNet-50 model generated from class ResNetBackbone(Backbone) is different from the pre-trained model from PyTorch.

Loaded pre-trained model from pytorch: image

From class ResNetBackbone(Backbone): image

Could you please tell me how to properly load the pre-trained ResNet-50? Thank you so much.

thom966 avatar Apr 24 '23 10:04 thom966

Pretrained weights from PyTorch are loaded automatically for ResNet50 unless you pass the '--no-pretrained-backbone' argument to main.py (see HERE).

Loading is done HERE. However, note that the weights are from torchvision v0.4.2 (see HERE), keys in newer versions may be different.

danielS91 avatar Apr 24 '23 11:04 danielS91