Skip to content
Discussion options

You must be logged in to vote

Your code looks correct to me, although there are probably more efficient ways to implement this. Currently, you are checking via masking whether a point is contained in a single cluster, which is very expensive to do on large-scale point clouds. While there exists sophisticated data structures for this use case, e.g., kd-trees, a probably easier way to do it is to convert ids into a list of tensors which hold the indices of nodes belonging to this cluster, and use that for indexing the global point cloud:

deg = torch_geometric.utils.degree(id_grid)
indices = id_grid.argsort().split(deg.tolist())

for index in indices:
    pos = data.pos[index]

Let me know if this speeds up things :)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@QuanticDisaster
Comment options

Answer selected by QuanticDisaster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants