ahu-dsp / PSCF-Net

Deeply coupled feedback network for pansharpening named PSCF-Net
5 stars 0 forks source link

Model Weights problem #1

Open matciotola opened 1 year ago

matciotola commented 1 year ago

"return super().find_class(mod_name, name) AttributeError: Can't get attribute 'ResNet' on <module 'Model' from './PSCF-Net-main/Model.py'>"

Seems that the uploaded Model.py is a different version than used for producing the weights. Please, provide the correct version of the Model.py or a working weights (saving the dictionary and not the model). Thanks, Matteo

ahu-dsp commented 1 year ago

Before the model was uploaded, we did not name the model name in the Model.py as PSCF_Net when training, which may be the cause of this bug. You can set where class PSCF_Net(nn. Module) changed to class ResNet(nn. Module) to see if the bug can be solved. Of course, if you have a dataset, you can choose not to use the pretrained model and retrain. In addition, if you have other training frameworks with a high level of integration, you can port the model to it for training, because this may solve some problems caused by different package versions.

matciotola commented 1 year ago

New error: RuntimeError: Given groups=1, weight of size [64, 4, 1, 1], expected input[1, 8, 2048, 2048] to have 4 channels, but got 8 channels instead

Are the weights uploaded correctly?

ahu-dsp commented 1 year ago

This model weight is the actual weight generated by our training. An error can be caused by many cases, using a pre-trained model requires your network settings to be the same as when training the model, you can see that the model name has cfb=3, and the model setting self.num_cfbs=4, which can cause problems, and the difference in batchsize can also make loading molds difficult. Therefore, to train successfully, you need to understand the overall structure of the code a little. Of course, if you have your own training framework and dataset, I still recommend that you port Model.py to your own code for training, because the code we submit to GitHub is adapted to the system and environment we tested, which may cause some difficulties for your use.