Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

def grp_range_torch in ptbev.py #53

Open
zoomin-lee opened this issue May 24, 2022 · 1 comment
Open

def grp_range_torch in ptbev.py #53

zoomin-lee opened this issue May 24, 2022 · 1 comment

Comments

@zoomin-lee
Copy link

Hi author, thanks you for your great work:)

I am trying to understand your grp_range_torch(random sampling at ptbev.py) through the toy example. But I couldn't understand what process it was. Can you explain it on this toy example? Or is there an equation in which this is implemented?

2022-05-24_10 29 13

Thanks

@YangZhang4065
Copy link
Collaborator

Sorry for the late reply!
Before jumping into the details, the idea of grp_range_torch is to generate range indices for points within each grid using vectorized operation. So that we can sample points within each grid/ pillar and make sure each grid has no more than self.max_pt points later easily.

This is equal to using a for loop to loop thru all points and only pick n points within each grid but more efficiently.

Going back to your case, you have grp_ind output grp_ind
image

image

and the output of the unique function unq_inv, which is basically the grid index of each point.

image

As you can see, unq_inv[1], unq_inv[5], and unq_inv[12] are all 5. This means these 3 points belong to the same grid (grid index 5). Thus grp_ind[0], grp_ind[5] and grp_ind[12] are 1, 2,3, meaning these 3 points are the 1st, 2nd, and 3rd points in the same cell.

Later on, you can use a[grp_ind < 2] to subsample 2 points from each grid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants