Closed xuhangc closed 2 years ago
During training process, I encountered the following error message. It seems that param is not in the input variable.
switching to testing mode Traceback (most recent call last): File "/home/ipprlab/Downloads/exposure-fusion-shadow-removal/./OE_train.py", line 123, in <module> model.set_input(data) File "/home/ipprlab/Downloads/exposure-fusion-shadow-removal/models/Fusion_model.py", line 171, in set_input self.shadow_param = input['param'].to(self.device).type(torch.float) KeyError: 'param'
During the test, the input['param'] does not exist, you need to write two-line codes to perform the judgement of current state
yes, here should add some statements like if to check the key exist or not. For the dataset reading, the param doesn't exist in testing.
Hi, @xuhangc I encounter the same problem as you. May I know how you fix this problem? As @yuhaoliu7456 suggested, I did write an if statement to skip input['param'] during the test.
if 'param' in input: #input['param] does not exist during the test
self.shadow_param = input['param'].to(self.device).type(torch.float)
However, I found that variable self.shadow_param will be used in forward method.
addgt = self.shadow_param[:, [0, 2, 4]]
mulgt = self.shadow_param[:, [1, 3, 5]]
Therefore I still encounter error when switching to test mode during training.
During training process, I encountered the following error message. It seems that param is not in the input variable.
switching to testing mode Traceback (most recent call last): File "/home/ipprlab/Downloads/exposure-fusion-shadow-removal/./OE_train.py", line 123, in <module> model.set_input(data) File "/home/ipprlab/Downloads/exposure-fusion-shadow-removal/models/Fusion_model.py", line 171, in set_input self.shadow_param = input['param'].to(self.device).type(torch.float) KeyError: 'param'