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

Use torch.max instead of torch.nn.MaxPool1d #18

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

JadenTravnik
Copy link

@JadenTravnik JadenTravnik commented Jun 27, 2018

According to the original paper, there should be no restriction on the number of points within a point cloud. This PR updates the pointnet to allow for variable number of points within a pointcloud or from mini-batch to mini-batch.

If one has a dataset that has different numbers of points within each point cloud, one way of using this is to upsample (similar to how images are padded with 0s when they are different sizes). However, one wants to minimize the number of added points because unlike image data, adding 0s in a point cloud changes the structure of the data. Instead, one should duplicate the fewest number of points such that each sample in a mini-batch has the same number of points but each mini-batch may have a different number of points per sample.

To do this, one should sort their dataset by the number of points within each point cloud, then group the point clouds into sizes of the desired mini-batch. For example one mini-batch may have point clouds of sizes: [901, 905, 905, ..., 945].
In order to upsample all pointclouds P in mini-batch_j, one randomly duplicates K points from a pointcloud P_i with N points where K is the difference between the current pointcloud size and the maximum pointcloud size in mini-batch_j (K = max(P_i.size() for P_i in mini-batch_j) - N).

For example, the previous example, the mini-batch will now have sizes [945, 945, 945, ..., 945] because the first pointcloud with size 901 had (945 - 901) 44 points duplicated, etc. Now that each mini-batch has the same number of points, one can train their network by randomly sampling these mini-batches.

According to the original paper, there should be no restriction on the number of points within a point cloud. This PR updates the pointnet to allow for variable number of points within a pointcloud or from mini-batch to mini-batch. If one has a dataset that has different numbers of points within each point cloud, one way of using this is to upsample (similar to how images are padded with 0s when they are different sizes). However, one wants to minimize the number of added points because unlike image data, adding 0s in a point cloud changes the structure of the data. Instead, one should duplicate the fewest number of points such that each sample in a mini-batch has the same number of points but each mini-batch may have a different number of points per sample. To do this, one should sort their dataset by the number of points within each point cloud, then group the point clouds into sizes of the desired mini-batch. For example one mini-batch may have point clouds of sizes [901, 905, 905, ..., 945]. In order to upsample all pointclouds P in mini-batch_j, one randomly duplicates K points from a point cloud P_i with N points where K is the difference between the current point cloud size and the maximum point cloud size in mini-batch_j (K = max(P_i.size() for P_i in mini-batch_j) - N ). For example, the previous example mini-batch will now have sizes [945, 945, 945, ..., 945] because the first point cloud with size 901 had (945 - 901 = 44) points duplicated to it etc. Now that each mini-batch has the same number of points, one can train their network by randomly sampling these mini-batches.
@fxia22 fxia22 merged commit 2ec315f into fxia22:master Oct 8, 2018
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

Successfully merging this pull request may close these issues.

2 participants