Knn algorithm
hanjungwoo1 opened this issue · comments
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.
I have the same problem ,too .have you solved it ?
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')
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