humanpose1 / MS-SVConv

Compute descriptors for 3D point cloud registration using a multi scale sparse voxel architecture
MIT License
63 stars 7 forks source link

A bug with torch #4

Closed akira2025 closed 3 years ago

akira2025 commented 3 years ago

Hi guys, I have a bug when running your code. when I run in Registration part. I have a problem below. I also try with my machine but also have same problem. I hope you can give me some suggestion. Thank you so much


OSError Traceback (most recent call last)

in () 6 import requests 7 import torch ----> 8 from torch_points3d.applications.pretrained_api import PretainedRegistry 9 from torch_points3d.core.data_transform import GridSampling3D, AddFeatByKey, AddOnes, Random3AxisRotation 10 from torch_points3d.datasets.registration.pair import Pair 8 frames /usr/local/lib/python3.7/dist-packages/torch_points3d/applications/pretrained_api.py in () 5 6 # Import building function for model and dataset ----> 7 from torch_points3d.datasets.dataset_factory import instantiate_dataset 8 from torch_points3d.models.model_factory import instantiate_model 9 /usr/local/lib/python3.7/dist-packages/torch_points3d/datasets/dataset_factory.py in () 4 import logging 5 ----> 6 from torch_points3d.datasets.base_dataset import BaseDataset 7 8 log = logging.getLogger(__name__) /usr/local/lib/python3.7/dist-packages/torch_points3d/datasets/base_dataset.py in () 6 import numpy as np 7 import torch ----> 8 import torch_geometric 9 from torch_geometric.transforms import Compose, FixedPoints 10 import copy /usr/local/lib/python3.7/dist-packages/torch_geometric/__init__.py in () 3 4 from .debug import is_debug_enabled, debug, set_debug ----> 5 import torch_geometric.data 6 import torch_geometric.transforms 7 import torch_geometric.utils /usr/local/lib/python3.7/dist-packages/torch_geometric/data/__init__.py in () ----> 1 from .data import Data 2 from .temporal import TemporalData 3 from .batch import Batch 4 from .dataset import Dataset 5 from .in_memory_dataset import InMemoryDataset /usr/local/lib/python3.7/dist-packages/torch_geometric/data/data.py in () 6 import torch 7 import torch_geometric ----> 8 from torch_sparse import coalesce, SparseTensor 9 from torch_geometric.utils import (contains_isolated_nodes, 10 contains_self_loops, is_undirected) /usr/local/lib/python3.7/dist-packages/torch_sparse/__init__.py in () 13 ]: 14 torch.ops.load_library(importlib.machinery.PathFinder().find_spec( ---> 15 f'{library}_{suffix}', [osp.dirname(__file__)]).origin) 16 17 if torch.cuda.is_available(): # pragma: no cover /usr/local/lib/python3.7/dist-packages/torch/_ops.py in load_library(self, path) 102 # static (global) initialization code in order to register custom 103 # operators with the JIT. --> 104 ctypes.CDLL(path) 105 self.loaded_libraries.add(path) 106 /usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error) 362 363 if handle is None: --> 364 self._handle = _dlopen(self._name, mode) 365 else: 366 self._handle = handle OSError: /usr/local/lib/python3.7/dist-packages/torch_sparse/_convert_cuda.so: undefined symbol: _ZNK2at6Tensor6deviceEv
humanpose1 commented 3 years ago

Hi @akira2025 ,

The bug with torch is solved! The problem was that the version of torch-sparse and torch were incompatible. But now there is a new bug with torchsparse. I opened an issue in there repo. Regards,

trinhnhut-gif commented 3 years ago

hi humanposes1 I also have a bug when testing today. I think the problem is torchsparse in new_coor line I am using torch 1.8.1+cuda 10.2 Thank you.


IndexError Traceback (most recent call last)

in () 4 with torch.no_grad(): 5 model.set_input(data_s, "cuda") ----> 6 feat_s = model.forward() 7 model.set_input(data_t, "cuda") 8 feat_t = model.forward() 12 frames /usr/local/lib/python3.7/dist-packages/torch_points3d/models/registration/ms_svconv3d.py in forward(self, *args, **kwargs) 252 253 def forward(self, *args, **kwargs): --> 254 self.output, outputs = self.apply_nn(self.input) 255 if self.match is None: 256 return self.output /usr/local/lib/python3.7/dist-packages/torch_points3d/models/registration/ms_svconv3d.py in apply_nn(self, input) 242 for i in range(len(self.grid_size)): 243 self.unet.set_grid_size(self.grid_size[i]) --> 244 out = self.unet(input.clone()) 245 out.x = out.x / (torch.norm(out.x, p=2, dim=1, keepdim=True) + 1e-20) 246 outputs.append(out) /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs) 887 result = self._slow_forward(*input, **kwargs) 888 else: --> 889 result = self.forward(*input, **kwargs) 890 for hook in itertools.chain( 891 _global_forward_hooks.values(), /usr/local/lib/python3.7/dist-packages/torch_points3d/models/registration/ms_svconv3d.py in forward(self, data, **kwargs) 82 d, cluster = self._prepare_data(inp) 83 d.x = self.pre_mlp(d.x) ---> 84 d = self.unet.forward(d) 85 inp_post_mlp = d.x[cluster] 86 if self.add_pos: /usr/local/lib/python3.7/dist-packages/torch_points3d/applications/sparseconv3d.py in forward(self, data, *args, **kwargs) 196 stack_down = [] 197 for i in range(len(self.down_modules) - 1): --> 198 data = self.down_modules[i](data) 199 stack_down.append(data) 200 /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs) 887 result = self._slow_forward(*input, **kwargs) 888 else: --> 889 result = self.forward(*input, **kwargs) 890 for hook in itertools.chain( 891 _global_forward_hooks.values(), /usr/local/lib/python3.7/dist-packages/torch_points3d/modules/SparseConv3d/modules.py in forward(self, x) 137 138 def forward(self, x): --> 139 out = self.conv_in(x) 140 if self.blocks: 141 out = self.blocks(out) /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs) 887 result = self._slow_forward(*input, **kwargs) 888 else: --> 889 result = self.forward(*input, **kwargs) 890 for hook in itertools.chain( 891 _global_forward_hooks.values(), /usr/local/lib/python3.7/dist-packages/torch/nn/modules/container.py in forward(self, input) 117 def forward(self, input): 118 for module in self: --> 119 input = module(input) 120 return input 121 /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs) 887 result = self._slow_forward(*input, **kwargs) 888 else: --> 889 result = self.forward(*input, **kwargs) 890 for hook in itertools.chain( 891 _global_forward_hooks.values(), /usr/local/lib/python3.7/dist-packages/torch_points3d/core/data_transform/../../../torchsparse/nn/modules/conv.py in forward(self, inputs) 86 stride=self.stride, 87 dilation=self.dilation, ---> 88 transpose=self.t) 89 90 /usr/local/lib/python3.7/dist-packages/torch_points3d/core/data_transform/../../../torchsparse/nn/functional/conv.py in conv3d(inputs, kernel, kernel_size, bias, stride, dilation, transpose) 131 kOffset = kRegion.get_kernel_offset().to(features.device) 132 new_coords = spF.spdownsample(coords, stride, kernel_size, --> 133 cur_stride) 134 hash_query = spF.sphash(new_coords, kOffset) 135 hash_target = spF.sphash(coords) /usr/local/lib/python3.7/dist-packages/torch_points3d/core/data_transform/../../../torchsparse/nn/functional/downsample.py in spdownsample(coords, ratio, kernel_size, tensor_stride) 67 # filter out duplicates 68 new_coords = torch.unique(new_coords, dim=0) ---> 69 new_coords = new_coords[:, [1, 2, 3, 0]] 70 return new_coords IndexError: too many indices for tensor of dimension 1
humanpose1 commented 3 years ago

Sorry for the trouble. Now I've fixed the problem, Actually I've downgraded the version of torchsparse.