aRI0U / RandLA-Net-pytorch

PyTorch implementation of RandLA-Net
338 stars 50 forks source link

Knn algorithm #19

Open hanjungwoo1 opened 3 years ago

hanjungwoo1 commented 3 years ago

can i get a knn algorithm in model.py as import and line 172.

I have a several promblems on import torch_points_kernels and torch_points.

makangzhe commented 3 years ago

I have the same problem ,too .have you solved it ?

hanjungwoo1 commented 3 years ago

def knn(pos_support, pos, k): """Dense knn serach Arguments: pos_support - [B,N,3] support points pos - [B,M,3] centre of queries k - number of neighboors, needs to be > N Returns: idx - [B,M,k] dist2 - [B,M,k] squared distances """ dist_all = [] points_all = [] for x, y in zip(pos_support, pos): kdtree = KDTree(x) dist, points = kdtree.query(y, k)

    dist_all.append(dist)
    points_all.append(points)

return torch.tensor(points_all, dtype=torch.int64, device='cuda'), torch.tensor(dist_all, dtype=torch.float64,
                                                                                device='cuda')
cctt126 commented 2 years ago

I met the same issue that can't find the knn function, silly me. The solution: pip install torch-points-kernels https://github.com/torch-points3d/torch-points-kernels