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

Please enter either pointcloud or meshes to compute bps #17

Open
antonagafonov opened this issue Oct 19, 2022 · 3 comments
Open

Please enter either pointcloud or meshes to compute bps #17

antonagafonov opened this issue Oct 19, 2022 · 3 comments

Comments

@antonagafonov
Copy link

Hi,
While running grab_new_objects.py encountering following issue:

python grabnet/tests/grab_new_objects.py --obj-path contact_meshes/camera.ply --rhm-path mano_v1_2/

2022-10-19 16:56:41,969 - root - INFO - Restored CoarseNet model from grabnet/models/coarsenet.pt
2022-10-19 16:56:41,975 - root - INFO - Restored RefineNet model from grabnet/models/refinenet.pt
2022-10-19 16:56:41,984 - root - INFO - #################
Colors Guide:
Gray ---> GrabNet generated grasp

Traceback (most recent call last):
File "/home/aa/Documents/GitHub/GrabNet/grabnet/tests/grab_new_objects.py", line 235, in
grab_new_objs(grabnet,obj_path, rot=True, n_samples=10)
File "/home/aa/Documents/GitHub/GrabNet/grabnet/tests/grab_new_objects.py", line 129, in grab_new_objs
bps_object = bps.encode(verts_obj, feature_type='dists')['dists']
File "/home/aa/miniconda3/envs/Pytorch3D/lib/python3.9/site-packages/bps_torch/bps.py", line 163, in encode
raise ('Please enter either pointcloud or meshes to compute bps!')
TypeError: exceptions must derive from BaseException

Can somebody please help me to solve this one?

Thanks

@GentlesJan
Copy link

I also have a same issue, could you please tell me the solution?

@waqc
Copy link

waqc commented Nov 29, 2022

Hi @antonagafonov @GentlesJan ,

I ran into similar problems recently and I have figured it out. I think this was caused by the PyTorch version change. In grab_new_objects.py, before passing verts_obj to bps.encode, you need to first transform it into torch.tensor. After calculating bps, you need to change it back to numpy array. I am not sure whether this is elegant but this is a fast solution.

In summary, find

bps_object = bps.encode(verts_obj, feature_type='dists')['dists']

in function grab_new_objs(grabnet, objs_path, rot=True, n_samples=10, scale=1.) in grab_new_objects.py and replace it by

verts_obj = torch.from_numpy(verts_obj)
bps_object = bps.encode(verts_obj, feature_type='dists')['dists']
verts_obj = verts_obj.numpy()

@otaheri
Copy link
Owner

otaheri commented Nov 29, 2022

Hi @waqc, thanks for the quick fix. Indeed, this is the source of the error. I updated the bps package but didnt notice that it will break this script. I updated this script accordingly, it should be working now. Let me know if you face any other issues.

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