Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result images seem not to be enhanced. #22

Closed
xiaofeng94 opened this issue Nov 15, 2018 · 4 comments
Closed

The result images seem not to be enhanced. #22

xiaofeng94 opened this issue Nov 15, 2018 · 4 comments

Comments

@xiaofeng94
Copy link

Hi @hezhangsprinter ,

I really appreciate this work and start trying to test your method with testing images (nature) and pre-trained model (netG_epoch_8.pth) you provide.
I change
netG.load_state_dict(torch.load(opt.netG))
to
netG.load_state_dict(torch.load(opt.netG),strict=False)
as #10 said to solve the following error,
KeyError: 'unexpected key "tran_dense.dense_block1.denselayer1.norm.1.weight" in state_dict'

I succeeded running demo.py, but it seems that the outputs were not enhanced, as the following samples shows,

10_dcpcn

My environment:
Ubuntu 16.04
Pytorch v0.3.1 with cuda 9.0
Python v3.5.2

BTW, would you like to remove the unused code. It really costs me some time to understand them. 😃

Thanks a lot!

@hezhangsprinter
Copy link
Owner

I have no idea what happens here since there is no useful information given to me.

But make sure you follow my code since I put some results obtained from my demo.py. For example, you should use net.train(). Please please go through my code in detail to make sure you are running properly.

@xiaofeng94
Copy link
Author

This problem is caused by my modification on netG.load_state_dict(torch.load(opt.netG)).

It seems that the author used torchvision v0.2.0 or earlier. However, the latest torchvision v0.2.1 has changed the the name 'norm.1' to 'norm0' in class _DenseLayer and thus "tran_dense.dense_block1.denselayer1.norm.1.weight" is not contained.

So, I change torchvision to v0.2.0 and everything go on well.

@huoguangdiandian
Copy link

I find a new idea to solve the problem. In fact, you do not change the version of torch. Only change the method that loading the model instead of original code.

@CBD88
Copy link

CBD88 commented May 11, 2020

I find a new idea to solve the problem. In fact, you do not change the version of torch. Only change the method that loading the model instead of original code.

Can you please share the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants