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

Error in classification_ModelNet40/models/pointmlp.py #99

Open
Psy-UESTC opened this issue Jan 11, 2025 · 1 comment
Open

Error in classification_ModelNet40/models/pointmlp.py #99

Psy-UESTC opened this issue Jan 11, 2025 · 1 comment

Comments

@Psy-UESTC
Copy link

Hi, Thanks for your sharing!
I try to test the pointmlp model and this bug just occured:
project/pointMLP-pytorch/classification_ModelNet40/models# python pointmlp.py
===> testing pointMLP ...
Traceback (most recent call last):
File "pointmlp.py", line 366, in
out = model(data)
File "/root/miniconda3/envs/pointmlp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "pointmlp.py", line 338, in forward
xyz, x = self.local_grouper_list[i](xyz, x.permute(0, 2, 1)) # [b,g,3] [b,g,k,d]
File "/root/miniconda3/envs/pointmlp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "pointmlp.py", line 161, in forward
fps_idx = pointnet2_utils.furthest_point_sample(xyz, self.groups).long() # [B, npoint]
File "/root/miniconda3/envs/pointmlp/lib/python3.7/site-packages/pointnet2_ops/pointnet2_utils.py", line 54, in forward
out = _ext.furthest_point_sampling(xyz, npoint)
RuntimeError: falseINTERNAL ASSERT FAILED at "/root/autodl-tmp/project/pointMLP-pytorch/pointnet2_ops_lib/pointnet2_ops/_ext-src/src/sampling.cpp":83, please report a bug to PyTorch. CPU not supported

And then I test whether my cuda is available:
Python 3.7.16 (default, Jan 17 2023, 22:20:44)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import torch
torch.cuda.is_available()
True

It seems like my cuda is setting properly. Could you please help me with this confused bug? Hoping for your reply,Thansk!

@ItayMeiri
Copy link

You need to install pointnet2_ops_lib/.

You could alternatively use pytorch geometrics fps which would require some changes, but you wouldn't need to install anything.

One possible solution is to do something like this:

# from torch_geometric.nn import fps

xyz_reshaped = xyz.view(-1, 3) # required since fps expected (batch_size * num points, 3)
batch_size, num_points = xyz.shape[0], xyz.shape[1]
batch = torch.arange(batch_size).repeat_interleave(num_points).to(xyz.device)
fps_idx = fps(xyz_reshaped, batch, ratio=S/num_points).view(batch_size, -1)
fps_idx = fps_idx  % num_points

# code would continue normally

I haven't tested this extensively, but it should work.

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

2 participants