drprojects/superpoint_transformer

knn search

Closed this issue · 1 comments

Hello

Thank's for your work

I try to search neighbors inside NAG. I load a h5 file from S3DIS with
nag = NAG.load(Area_6_conferenceRoom_1.h5)

Then I want to search the k-neighbors of idx = 3 from partition 3 (knn-searching inside partition 3) :
knn_2(nag.select(3, idx)[3]['pos'], nag[3]['pos'], k = 16)

And I got
File "superpoint_transformer/src/dependencies/FRNN/frnn/frnn.py", line 174, in forward idxs, dists = _C.find_nbrs_cuda(sorted_points1, sorted_points2, RuntimeError: Unknown layout

Do you have any ideas ?

Thank's in advance.

If I understand correctly, you want to search the KNN of the superpoint number idx from partition $P_3$, among the other superpoint centroids of $P_3$ ?

If so

level = 3
k = 16
r_max = 1  # maximum radius within which to search for neighbors, adjust this to your needs

knn_2(
    nag[level]['pos'][idx].view(1, -1),  # centroid position of the `idx`th superpoint/node at a given `level`
    nag[level]['pos'], 
    k,  # NB this is an arg and not a kwarg
    r_max=r_max)