BangguWu / ECANet

Code for ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks
MIT License
1.24k stars 197 forks source link

Pre-trained models #43

Closed Darshan-Ramesh closed 3 years ago

Darshan-Ramesh commented 3 years ago

Hello Folks,

I am facing an issue while trying to use the pre-trained models. Here are the steps that I have followed.

  1. I downloaded the "eca_resnet50_k3557.pth.tar" from google drive.
  2. Constructed the model using models/eca_resnet.py and models/eca_module.py

Now the pre-trained model from step 1 has "module.conv1.." as its state keys while the model from step 2 has "conv1.weight.", which are key mismatches. I also found that the pre-trained model from Step 1 has a key "ärch = 'se_resnet50".

Question 1. Is this pre-trained model not of ECA Net but of SE Net? Question 2. How to solve the key mismatch issues?

Could you please let me know how to solve this?

BangguWu commented 3 years ago

Thanks for your attention. Question 1: Pre-trained model is ECA. Question 2: The parameter name contains “module.”, which is a problem of the python mechanism. You can remove it manually

Darshan-Ramesh commented 3 years ago

Thanks for your kind reply. Could you perhaps post some hints on how to rename the keys since they are immutable?

BangguWu commented 3 years ago

reference: https://discuss.pytorch.org/t/transfer-learning-missing-key-s-in-state-dict-unexpected-key-s-in-state-dict/33264/3

Darshan-Ramesh commented 3 years ago

Thank you very much. I appreciate the support and guidance 👍 😊