CuiRuikai / Partial2Complete

[ICCV 2023] P2C: Self-Supervised Point Cloud Completion from Single Partial Clouds
MIT License
146 stars 7 forks source link

Question about RCD #15

Open xwayuzu opened 5 months ago

xwayuzu commented 5 months ago

Thank you for your work! I'm interested in the RCD loss you designed. When I look at the code of the network, I see that the loss of use is ChamferDistanceL1. May I ask where the lost code of RCD is?

CuiRuikai commented 5 months ago

Thank you for your interest. I did not encapsulate the RCD as a python class, but instead it is implemented using the code in Partial2Complete/models/P2C.py line 168-171.

rebuild_points = nbr_groups[1] + center_groups[1].unsqueeze(-2)
idx = pointops.knn(center_groups[1], pred,  int(self.nbr_ratio * self.group_size))[0]
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)
shape_matching_loss = self.shape_matching_weight * self.shape_criterion(rebuild_points.reshape(B, -1, 3), nbrs_pred).mean()

The RCD first sample center point in the partial shape, this is finished in the group points stage (line 152).

nbrs , center = self.group_divider(pts)  # neighborhood, center

Then, it extracts local patches around center points in both partial and predicted shape. For partial shapes, this is also finished in line 152. For predicted points, we first extract KNN index, then extract local patches as shown in the first code block.

idx = pointops.knn(center_groups[1], pred,  int(self.nbr_ratio * self.group_size))[0]
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)

We then do a union operation

rebuild_points = nbr_groups[1] + center_groups[1].unsqueeze(-2)  # for partial point cloud
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)  # for predicted point cloud, .reshape(B, -1, 3) do the union operation

Then, the RCD compute the Chamfer distance between the union of patches,

self.shape_criterion(rebuild_points.reshape(B, -1, 3), nbrs_pred).mean()

I am sorry the code I wrote might be too confusing. Please let me know if you have further concerns

xwayuzu commented 5 months ago

Thank you for your interest. I did not encapsulate the RCD as a python class, but instead it is implemented using the code in Partial2Complete/models/P2C.py line 168-171.

rebuild_points = nbr_groups[1] + center_groups[1].unsqueeze(-2)
idx = pointops.knn(center_groups[1], pred,  int(self.nbr_ratio * self.group_size))[0]
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)
shape_matching_loss = self.shape_matching_weight * self.shape_criterion(rebuild_points.reshape(B, -1, 3), nbrs_pred).mean()

The RCD first sample center point in the partial shape, this is finished in the group points stage (line 152).

nbrs , center = self.group_divider(pts)  # neighborhood, center

Then, it extracts local patches around center points in both partial and predicted shape. For partial shapes, this is also finished in line 152. For predicted points, we first extract KNN index, then extract local patches as shown in the first code block.

idx = pointops.knn(center_groups[1], pred,  int(self.nbr_ratio * self.group_size))[0]
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)

We then do a union operation

rebuild_points = nbr_groups[1] + center_groups[1].unsqueeze(-2)  # for partial point cloud
nbrs_pred = pointops.index_points(pred, idx).reshape(B, -1, 3)  # for predicted point cloud, .reshape(B, -1, 3) do the union operation

Then, the RCD compute the Chamfer distance between the union of patches,

self.shape_criterion(rebuild_points.reshape(B, -1, 3), nbrs_pred).mean()

I am sorry the code I wrote might be too confusing. Please let me know if you have further concerns

Thank you very much for answering my question in detail! Your answer is of great help to me.

CuiRuikai commented 5 months ago

I am sorry that I am not familiar with scene flow matching. The motivation of RCD is that the ground truth is a subset of the prediction, we want to have a stronger supervision to the known parts to be matched.

xwayuzu commented 5 months ago

I am sorry that I am not familiar with scene flow matching. The motivation of RCD is that the ground truth is a subset of the prediction, we want to have a stronger supervision to the known parts to be matched.

Thanks for your reply!