Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test_shape failed with torchsparse 1.2 #25

Closed
YoushaaMurhij opened this issue Dec 16, 2021 · 5 comments
Closed

Test_shape failed with torchsparse 1.2 #25

YoushaaMurhij opened this issue Dec 16, 2021 · 5 comments

Comments

@YoushaaMurhij
Copy link

YoushaaMurhij commented Dec 16, 2021

Good work! I manged to get the shape using Test_shape.py but when using test_shape.py, I faced this error:

root@PC:/home/adelai_ws/AdelaiDepth# python3 LeReS/tools/test_shape.py --load_ckpt res101.pth --backbone resnext101
No protocol specified
processing (0000)-th image... LeReS/test_images/5.jpg
Traceback (most recent call last):
  File "LeReS/tools/test_shape.py", line 123, in <module>
    shift, focal_length, depth_scaleinv = reconstruct3D_from_depth(rgb, pred_depth_ori,
  File "LeReS/tools/test_shape.py", line 76, in reconstruct3D_from_depth
    shift_1 = refine_shift(pred_depth_norm, shift_model, predicted_focal_1, cam_u0, cam_v0)
  File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 124, in refine_shift
    shift = refine_shift_one_step(depth_wshift_tmp, model, focal, u0, v0)
  File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 108, in refine_shift_one_step
    outputs = model(inputs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 148, in forward
    x2 = self.stage2(x1)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 23, in forward
    out = self.net(x)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/modules/conv.py", line 72, in forward
    return conv3d(inputs,
  File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/conv.py", line 118, in conv3d
    idx_query = list(convert_neighbor_map_gpu(idx_query))
  File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/convert_neighbor_map.py", line 9, in forward
    idx_batch, idx_point = torch.where(neighbor_map != -1)
ValueError: not enough values to unpack (expected 2, got 1)

I tried another version (1.4) but there is a change in the API. Any suggestions?
Thanks!

@YoushaaMurhij YoushaaMurhij changed the title Test_shape failed with torchspace 1.2 Test_shape failed with torchsparse 1.2 Dec 16, 2021
@srikanth-midde
Copy link

Hi,
Can any help me to sort out this issue?
I got the same "ValueError: not enough values to unpack (expected 2, got 1)" error.
Though I tried with both torchsparse v1.2 and v1.4. but facing the same issue.

@isamabdullah88
Copy link

Hey you can replace first line with second line with torchsparse==1.4
Replace this:
from torchsparse.utils import sparse_collate_fn, sparse_quantize
with this:
from torchsparse.utils.collate import sparse_collate_fn from torchsparse.utils.quantize import sparse_quantize

It'll work with torchsparse==1.4

@isamabdullah88
Copy link

Hey,
Please check for default values for models in the test_shape.py and test_depth.py scripts.
Those values are different (resnet50 and resnet101), and they have to be the same.

@Ir1d
Copy link

Ir1d commented Oct 27, 2022

@isamabdullah88 What do you mean by default values? the values are the same
@YoushaaMurhij Can you please share how you solved this?

@isamabdullah88
Copy link

isamabdullah88 commented Oct 28, 2022

@Ir1d

  • Firstly move the model files to specified location and make sure the weight files are being read by the script. Place a check in code for that. I think the above error happens because of weight files not available.
  • Then, make sure that --load_ckpt and --backbone both use the same model. (Either resnet101.pth or resnet50.pth).

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants