plemeri / InSPyReNet

Official PyTorch implementation of Revisiting Image Pyramid Structure for High Resolution Salient Object Detection (ACCV 2022)
MIT License
321 stars 61 forks source link

Pretrained model on ECSSD dataset #9

Closed rakesh-reddy95 closed 1 year ago

rakesh-reddy95 commented 1 year ago

I see that the code is updated for res2net but the backbone model isn't due to which the keys are mis-matched while loading. Can I get the backbone model with the updated network?

plemeri commented 1 year ago

Hello again, glad to see you back.

Unfortunately, we only have one option for Res2Net backbone model, so if you need any specific dataset for training, you need to change the yaml config file of res2net backbone network (InSPyReNet_Res2Net50.yaml). You can find how to change training dataset is in Getting Started / preparation section.

Moreover, for SwinB backbone, there are various options of pre-trained checkpoints, but we don't have a checkpoint for trained with ECSSD dataset only since it usually used for benchmark only.

If you need a specific checkpoint and cannot access to any GPU machine, then please let me know that I can train on my machine as you need.

Thank you

plemeri commented 1 year ago

Unintentionally closed issue while responding. Reopening for further comments.

rakesh-reddy95 commented 1 year ago

Thanks, I figured it out and made a comment. I have reverted to the code to the commit 76767a9 to make it work. I see the lines: self.avgpool = nn.AdaptiveAvgPool2d(1) self.fc = nn.Linear(512 * block.expansion, num_classes)

has been removed while the existing model's graph fetches for it as the model is trained using this. Hence the error is being occured: [RuntimeError: Error(s) in loading state_dict for ResNet: Missing key(s) in state_dict: "fc.weight", "fc.bias". in loading state_dict of a resnet model]

And was able to fix upon reverting.

plemeri commented 1 year ago

We actually removed find_unused_parameters=True from loading pre-trained checkpoint and changed ImageNet pre-trained checkpoint for res2net to resolve the runtime error that you mentioned. You can download again from Getting Started / backbone checkpoints section. Please replace the old checkpoint with new one.

Therefore, reverting the commit 76767a9 is unnecessary so far. Sorry for the inconvenience.

rakesh-reddy95 commented 1 year ago

Thank you for the quick turnaround. Can close this issue now.

plemeri commented 1 year ago

Glad to be your help. Please feel free to contact me anytime. Have a great day!