XiandaGuo/OpenStereo

The size of tensor a (156) must match the size of tensor b (155) at non-singleton dimension 4

Closed this issue · 1 comments

Thank you for your work, but I have some problems with the training.

Traceback (most recent call last):
File "/home/lixj/StereoMatch/OpenStereo_6_5/tools/train.py", line 113, in
main()
File "/home/lixj/StereoMatch/OpenStereo_6_5/tools/train.py", line 109, in main
model_trainer.evaluate(current_epoch)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/trainer_template.py", line 165, in evaluate
self.eval_one_epoch(current_epoch=current_epoch)
File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/trainer_template.py", line 271, in eval_one_epoch
model_pred = self.model(data)
File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet.py", line 24, in forward
cost_out = self.CostProcessor(inputs)
File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 244, in forward
costs = self.aggregator(cat_cost)
File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 187, in forward
out1, pre1, post1 = self.dres2(cost0, None, None)
File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 127, in forward
post = F.relu(self.conv5(out) + pre, inplace=True)
RuntimeError: The size of tensor a (156) must match the size of tensor b (155) at non-singleton dimension 4

This is the problem I encountered when training the kitti12 dataset with the PSMNet network. Similar problems will occur whether I use the IGEVNet network or other networks to train the kitti15 dataset.
How to fix it?Thank you!

zhcm commented

Thank you for your work, but I have some problems with the training.

Traceback (most recent call last): File "/home/lixj/StereoMatch/OpenStereo_6_5/tools/train.py", line 113, in main() File "/home/lixj/StereoMatch/OpenStereo_6_5/tools/train.py", line 109, in main model_trainer.evaluate(current_epoch) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/trainer_template.py", line 165, in evaluate self.eval_one_epoch(current_epoch=current_epoch) File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/trainer_template.py", line 271, in eval_one_epoch model_pred = self.model(data) File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet.py", line 24, in forward cost_out = self.CostProcessor(inputs) File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 244, in forward costs = self.aggregator(cat_cost) File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 187, in forward out1, pre1, post1 = self.dres2(cost0, None, None) File "/home/lixj/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/lixj/StereoMatch/OpenStereo_6_5/stereo/modeling/models/psmnet/psmnet_cost_processor.py", line 127, in forward post = F.relu(self.conv5(out) + pre, inplace=True) RuntimeError: The size of tensor a (156) must match the size of tensor b (155) at non-singleton dimension 4

This is the problem I encountered when training the kitti12 dataset with the PSMNet network. Similar problems will occur whether I use the IGEVNet network or other networks to train the kitti15 dataset. How to fix it?Thank you!

you can't use 1240 as input size