Hi,
You’ve modified ResNet50 and you are trying to load weights from pre-trained vanilla ResNet50 which is causing the error because the pre-trained network doesn’t have weights for your modified layers ChannelAttention and SpatialAttention. I guess you have made modifications to torchvision source code. Don’t make any changes to the source code and implement a custom network and then add weights to your custom model by iterating state_dict of pretrained ResNet50 from torchvision.