alterzero / DBPN-Pytorch

The project is an official implement of our CVPR2018 paper "Deep Back-Projection Networks for Super-Resolution" (Winner of NTIRE2018 and PIRM2018)
https://alterzero.github.io/projects/DBPN.html
MIT License
565 stars 164 forks source link

I inserted some layers into dbpn.py,and it can be trained successfully.But failed to test. #47

Open yangyingni opened 5 years ago

yangyingni commented 5 years ago

It shows RuntimeError:Error(s) in loading state_dict for Net: Missing key(s) in state_dict:"feat0.conv.bias","feat0.conv.weight","feat0.conv.act.weight"........... Unexcepted key(s) in state_dict:"moudle.feat0.conv.weight","moudle.feat0.conv.bias"........

Can you give me some advices?Thank you very much.

shazib-summar commented 3 years ago

I'm probably a little late to the party, but let me answer this for the future wanderers. When you modify the network by adding/removing a layer or doing anything that modifies the architecture of the network, you are inherently changing the whole model itself.

Simply put, you made a new network. The state dict you're using is for the original model, and hence does not include the parameter entries for your layers. If you wish to test your modified network you will have to train it from scratch (which I wont suggest) or you can use transfer learning (which might save you a lot of time by converging to a lower loss quicker).

You may have to write your own script that initializes the weights of the original layers from the original state dict while using some other parameters initialization method (Glorot, He, Xavier initialization are some of them. Also see this) for the newer layers that you added.

Hope that helps.