DeOccNet icon indicating copy to clipboard operation
DeOccNet copied to clipboard

Testing error of the DeOccNet : RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 122 but got size 121 for tensor number 1 in the list.

Open El-Farouk opened this issue 2 years ago • 1 comments

i face this issue when i try to test your model torch.Size([1, 512, 122, 90]) torch.Size([1, 512, 121, 90]) Traceback (most recent call last): File "c:\mostafa_farouk_work\DeOccNet\DeOccNet_codes\test25.py", line 35, in main(int(1+i)) File "c:\mostafa_farouk_work\DeOccNet\DeOccNet_codes\test25.py", line 28, in main result = test_(test_loader, SceneIdx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\mostafa_farouk_work\DeOccNet\DeOccNet_codes\test25.py", line 18, in test_ out = net(data) ^^^^^^^^^ File "C:\Users\Mostafa\AppData\Local\anaconda3\envs\MainPyTorchEnv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Mostafa\AppData\Local\anaconda3\envs\MainPyTorchEnv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\mostafa_farouk_work\DeOccNet\DeOccNet_codes\model.py", line 41, in forward buffer_3L = torch.cat((buffer_3L, buffer_3), 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 122 but got size 121 for tensor number 1 in the list.

i printed this torch.Size([1, 512, 122, 90]) torch.Size([1, 512, 121, 90]) to ensure about the dimensions of the two tensors and actually the third parameter is different in the two parameters so whet is the solution?

El-Farouk avatar Jan 08 '24 04:01 El-Farouk

And This happen when i set the loop in the main to be greater than 6
if name == 'main': for i in range(7): print(int(1+i)) main(int(1+i)) when i try to test more than 6 images it throw the error

El-Farouk avatar Jan 08 '24 05:01 El-Farouk