pointMLP-pytorch icon indicating copy to clipboard operation
pointMLP-pytorch copied to clipboard

Error in classification_ModelNet40/models/pointmlp.py

Open Psy-UESTC opened this issue 11 months ago • 1 comments

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!

Psy-UESTC avatar Jan 11 '25 04:01 Psy-UESTC

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.

ItayMeiri avatar Jan 28 '25 23:01 ItayMeiri