EryiXie / PlaneRecNet

This is an official implementation for "PlaneRecNet" (BMVC 2021).
MIT License
78 stars 18 forks source link

Feature tensors with different shapes. #6

Closed cnu1439 closed 2 years ago

cnu1439 commented 2 years ago

Hi, thanks for the code. When i was testing with pre-trained models with test image I'm getting following error. Attaching test image. Thanks.

(prn_test) dev@linux:/workspace/planerecnet$ python3 simple_inference.py --config=PlaneRecNet_101_config --trained_model=weights/PlaneRecNet_101_9_125000.pth --image=test.jpg:/workspace/test.jpg Inference image: test.jpg torch.Size([425, 640, 3]) test.jpg /home/dev/miniconda/envs/prn_test/lib/python3.9/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1634272204863/work/aten/src/ATen/native/TensorShape.cpp:2157.) return _VF.meshgrid(tensors, kwargs) # type: ignore[attr-defined] torch.Size([1, 128, 107, 160]) torch.Size([1, 128, 108, 160]) Traceback (most recent call last): File "/workspace/planerecnet/simple_inference.py", line 357, in inference_image(net, inp, out, depth_mode=args.depth_mode) File "/workspace/planerecnet/simple_inference.py", line 154, in inference_image results = net(batch) File "/home/dev/miniconda/envs/prn_test/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, *kwargs) File "/workspace/planerecnet/planerecnet.py", line 93, in forward mask_pred = self.mask_head(mask_features) File "/home/dev/miniconda/envs/prn_test/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, kwargs) File "/workspace/planerecnet/planerecnet.py", line 494, in forward feature_add_all_level += self.convs_all_levelsi RuntimeError: The size of tensor a (107) must match the size of tensor b (108) at non-singleton dimension 2

test

wangyusenofficial commented 2 years ago

I think this due to the Unet structure, the input img size must be guaranteed to be divided by 2^n (n is the number of unet layers).

cnu1439 commented 2 years ago

yeah. got it. working now. thanks for the reply.

EryiXie commented 2 years ago

To be more accurate, the image height and width should be evenly divided by 32.