xinntao / EDVR

Winning Solution in NTIRE19 Challenges on Video Restoration and Enhancement (CVPR19 Workshops) - Video Restoration with Enhanced Deformable Convolutional Networks. EDVR has been merged into BasicSR and this repo is a mirror of BasicSR.
https://github.com/xinntao/BasicSR
1.48k stars 320 forks source link

RuntimeError: The size of tensor a (125) must match the size of tensor b (126) at non-singleton dimension 3 #154

Closed lostfordream closed 4 years ago

lostfordream commented 4 years ago

imagesize 1000*580

0-06-10 10:17:16.362 - INFO: Data: blur - ../datasets/REDS4/blur 20-06-10 10:17:16.362 - INFO: Padding mode: replicate 20-06-10 10:17:16.363 - INFO: Model path: ../experiments/pretrained_models/EDVR_REDS_deblur_L.pth 20-06-10 10:17:16.363 - INFO: Save images: True 20-06-10 10:17:16.363 - INFO: Flip test: False File "test_Vid4_REDS4_with_GT.py", line 208, in main() File "test_Vid4_REDS4_with_GT.py", line 148, in main output = util.single_forward(model, imgs_in) File "D:\deblur\EDVR\codes\utils\util.py", line 187, in single_forward model_output = model(inp) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, kwargs) File "D:\deblur\EDVR\codes\models\archs\EDVR_arch.py", line 259, in forward L1_fea = self.pre_deblur(x.view(-1, C, H, W)) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, *kwargs) File "D:\deblur\EDVR\codes\models\archs\EDVR_arch.py", line 52, in forward L2_fea = self.RB_L2_1(L2_fea) + L3_fea RuntimeError: The size of tensor a (125) must match the size of tensor b (126) at non-singleton dimension 3 PS D:\deblur\EDVR\codes> cd 'd:\deblur\EDVR\codes'; & 'd:\ProgramData\Anaconda3\python.exe' 'c:\Users\Wang.vscode\extensions\ms-python.python-2020.5.86398\pythonFiles\lib\python\debugpy\wheels\debugpy\launcher' '14901' '--' 'test_Vid4_REDS4_with_GT.py' 20-06-10 10:20:02.752 - INFO: Data: blur - ../datasets/REDS4/blur 20-06-10 10:20:02.753 - INFO: Padding mode: replicate 20-06-10 10:20:02.753 - INFO: Model path: ../experiments/pretrained_models/EDVR_REDS_deblur_L.pth 20-06-10 10:20:02.753 - INFO: Save images: True 20-06-10 10:20:02.753 - INFO: Flip test: False File "test_Vid4_REDS4_with_GT.py", line 208, in main() File "test_Vid4_REDS4_with_GT.py", line 148, in main output = util.single_forward(model, imgs_in) File "D:\deblur\EDVR\codes\utils\util.py", line 187, in single_forward model_output = model(inp) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(input, kwargs) File "D:\deblur\EDVR\codes\models\archs\EDVR_arch.py", line 259, in forward L1_fea = self.pre_deblur(x.view(-1, C, H, W)) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs) File "D:\deblur\EDVR\codes\models\archs\EDVR_arch.py", line 52, in forward L2_fea = self.RB_L2_1(L2_fea) + L3_fea RuntimeError: The size of tensor a (125) must match the size of tensor b (126) at non-singleton dimension 3

yuru-S commented 3 years ago

Did you have done?please share yours.

ckkelvinchan commented 3 years ago

This is due to the fact that the size of your input image is not divisible by 16 (since EDVR first downsamples the images by 4 times for deblurring, and PCD will further downsample the features by 4 times).

You should do padding to avoid this error.