Closed LiMinghui19 closed 2 years ago
您好!我这里test时似乎并没有遇到这个问题。报错信息中显示Missing key中有convd4xconvd4x,但是MSBDN里似乎应该没有这一项?
你好,我看您说使用您提供的'PSD-FFANET'模型时测试没有问题;想问一下您的测试方法?我在测试的时候遇到这个问题,多次修改之后还是未果,请问在测试过程中进行了哪些代码调整,以及测试图片是放在自己新建的data数据集中吗?
Traceback (most recent call last):
File "D:\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-a7c6de5829d6>", line 1, in <module>
runfile('C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD/test.py', wdir='C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD')
File "D:\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD/test.py", line 35, in <module>
test_data_loader = DataLoader(TestData_FFA(test_data_dir), batch_size=1, shuffle=False, num_workers=8) # For FFA and MSBDN
File "C:\Users\sweet_li\Desktop\PSD\PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main\PSD\datasets\pretrain_datasets.py", line 489, in __init__
self.haze_names = list(os.walk(self.haze_dir))[0][2]
IndexError: list index out of range
你好,我看您说使用您提供的'PSD-FFANET'模型时测试没有问题;想问一下您的测试方法?我在测试的时候遇到这个问题,多次修改之后还是未果,请问在测试过程中进行了哪些代码调整,以及测试图片是放在自己新建的data数据集中吗?
Traceback (most recent call last): File "D:\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-a7c6de5829d6>", line 1, in <module> runfile('C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD/test.py', wdir='C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD') File "D:\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/sweet_li/Desktop/PSD/PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main/PSD/test.py", line 35, in <module> test_data_loader = DataLoader(TestData_FFA(test_data_dir), batch_size=1, shuffle=False, num_workers=8) # For FFA and MSBDN File "C:\Users\sweet_li\Desktop\PSD\PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors-main\PSD\datasets\pretrain_datasets.py", line 489, in __init__ self.haze_names = list(os.walk(self.haze_dir))[0][2] IndexError: list index out of range
I met the same problem.you can modify net.load_state_dict(torch.load('./PSD-MODELS/PSB-MSBDN')) to net.load_state_dict(torch.load('./PSD-MODELS/PSB-MSBDN'),False)
test.py当我使用您提供的'PSD-FFANET'模型时测试没有问题; 但是当切换成使用‘’PSB-MSBDN‘’模型时报错:
RuntimeError: Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: "module.convd4xconvd4x.conv2d.weight", "module.convd4xconvd4x.conv2d.bias". Unexpected key(s) in state_dict: "module.convd4x.conv2d.weight", "module.convd4x.conv2d.bias".
求解答!