HsinYingLee / DRIT

Learning diverse image-to-image translation from unpaired data
844 stars 155 forks source link

change the file name load error #2

Closed c1a1o1 closed 6 years ago

c1a1o1 commented 6 years ago

E:\Users\Raytine\Anaconda3\python.exe F:/zhaiyao/DRIT-master/src/ptest.py --dataroot ../datasets/portrait --name portrait --resume ../results/01199.pth

--- load options --- a2b: 1 concat: 1 crop_size: 216 dataroot: ../datasets/portrait gpu: 0 input_dim_a: 3 input_dim_b: 3 nThreads: 4 name: portrait num: 5 phase: test resize_size: 256 result_dir: ../outputs resume: ../results/01199.pth

--- load dataset --- A: 594 images

--- load model --- Traceback (most recent call last): File "F:/zhaiyao/DRIT-master/src/ptest.py", line 50, in main() File "F:/zhaiyao/DRIT-master/src/ptest.py", line 25, in main model.resume(opts.resume, train=False) File "F:\zhaiyao\DRIT-master\src\model.py", line 401, in resume self.enc_a.load_state_dict(checkpoint['enc_a']) File "E:\Users\Raytine\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 721, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for E_attr_concat: Missing key(s) in state_dict: "fc_A.0.bias", "fc_A.0.weight", "fcVar_A.0.bias", "fcVar_A.0.weight", "conv_A.1.bias", "conv_A.1.weight", "conv_A.2.conv.2.bias", "conv_A.2.conv.2.weight", "conv_A.2.conv.4.1.bias", "conv_A.2.conv.4.1.weight", "conv_A.2.shortcut.1.bias", "conv_A.2.shortcut.1.weight", "conv_A.3.conv.2.bias", "conv_A.3.conv.2.weight", "conv_A.3.conv.4.1.bias", "conv_A.3.conv.4.1.weight", "conv_A.3.shortcut.1.bias", "conv_A.3.shortcut.1.weight", "conv_A.4.conv.2.bias", "conv_A.4.conv.2.weight", "conv_A.4.conv.4.1.bias", "conv_A.4.conv.4.1.weight", "conv_A.4.shortcut.1.bias", "conv_A.4.shortcut.1.weight", "fc_B.0.bias", "fc_B.0.weight", "fcVar_B.0.bias", "fcVar_B.0.weight", "conv_B.1.bias", "conv_B.1.weight", "conv_B.2.conv.2.bias", "conv_B.2.conv.2.weight", "conv_B.2.conv.4.1.bias", "conv_B.2.conv.4.1.weight", "conv_B.2.shortcut.1.bias", "conv_B.2.shortcut.1.weight", "conv_B.3.conv.2.bias", "conv_B.3.conv.2.weight", "conv_B.3.conv.4.1.bias", "conv_B.3.conv.4.1.weight", "conv_B.3.shortcut.1.bias", "conv_B.3.shortcut.1.weight", "conv_B.4.conv.2.bias", "conv_B.4.conv.2.weight", "conv_B.4.conv.4.1.bias", "conv_B.4.conv.4.1.weight", "conv_B.4.shortcut.1.bias", "conv_B.4.shortcut.1.weight". Unexpected key(s) in state_dict: "model_a.1.weight", "model_a.1.bias", "model_a.4.weight", "model_a.4.bias", "model_a.7.weight", "model_a.7.bias", "model_a.10.weight", "model_a.10.bias", "model_a.13.weight", "model_a.13.bias", "model_a.16.weight", "model_a.16.bias", "model_b.1.weight", "model_b.1.bias", "model_b.4.weight", "model_b.4.bias", "model_b.7.weight", "model_b.7.bias", "model_b.10.weight", "model_b.10.bias", "model_b.13.weight", "model_b.13.bias", "model_b.16.weight", "model_b.16.bias".

hytseng0509 commented 6 years ago

You need to add an option "--concat 0". We have different encoder/generator architecture for feature-wise transformation (default: "--concat 1", which is feature concatenation).

c1a1o1 commented 6 years ago

Thank you very much!