hezhangsprinter / DCPDN

Densely Connected Pyramid Dehazing Network (CVPR'2018)
401 stars 112 forks source link

demo execution error #10

Open tjqansthd opened 6 years ago

tjqansthd commented 6 years ago

Hi, I stopped at the error message while executing demo.py

(M.S.Song-pytorch) ubuntu@ubuntu:~/Drive_B/A.H.Cha_B/DCPDN$ python demo.py --dataroot ./facades/nat_new4 --valDataroot ./facades/nat_new4 --netG ./demo_model/netG_epoch_8.pth Namespace(annealEvery=400, annealStart=0, batchSize=1, beta1=0.5, dataroot='./facades/nat_new4', dataset='pix2pix', display=5, evalIter=500, exp='sample', imageSize=1024, inputChannelSize=3, lambdaGAN=0.01, lambdaIMG=1, lrD=0.0002, lrG=0.0002, mode='B2A', ndf=64, netD='', netG='./demo_model/netG_epoch_8.pth', ngf=64, niter=400, originalSize=1024, outputChannelSize=3, poolSize=50, valBatchSize=1, valDataroot='./facades/nat_new4', wd=0.0, workers=1) Random Seed: 7412 /home/ubuntu/anaconda3/envs/M.S.Song-pytorch/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py:191: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. Traceback (most recent call last): File "demo.py", line 134, in <module> netG.load_state_dict(torch.load(opt.netG)) File "/home/ubuntu/anaconda3/envs/M.S.Song-pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 522, in load_state_dict .format(name)) KeyError: 'unexpected key "tran_dense.dense_block1.denselayer1.norm.1.weight" in state_dict'

I put in 36 of h5 file in nat_new4 in facades, and put in 400 of h5 file in val512 in facades.

my system info: Linux python 3.6.6 pytorch 0.3.1 cuda80 conda 4.3.30

can i solve this problem? KeyError: 'unexpected key "tran_dense.dense_block1.denselayer1.norm.1.weight" in state_dict' thanks for reading

monkiq commented 6 years ago

I have the same wrong,do you solve it ?

JimWang97 commented 6 years ago

netG.load_state_dict(torch.load(opt.netG),strict=False) you should change the code like this in File "demo.py", line 134 @Jzdoxc

monkiq commented 5 years ago

Thank you !

huoguangdiandian commented 5 years ago

I have solved the problem. To change the method of loading the model. If you need ,can leave a message