pnp-3d icon indicating copy to clipboard operation
pnp-3d copied to clipboard

How to use it in detail?

Open TohsakaSheep opened this issue 3 years ago • 7 comments

I followed the instruction to place PnP-3D module after each Set Abstraction (SA) layer in "pointnet2_cls_msg.py" and "pointnet2_cls_ssg" like this. But it didn't work. How should I change the input of pnp3_module()? l1_xyz, l1_points = self.sa1(xyz, norm) l1_xyz, l1_points = pnp3d.pnp3d_module() # pnp3d l2_xyz, l2_points = self.sa2(l1_xyz, l1_points) l2_xyz, l2_points = pnp3d.pnp3d_module() # pnp3d l3_xyz, l3_points = self.sa3(l2_xyz, l2_points) l3_xyz, l3_points = pnp3d.pnp3d_module() # pnp3d

TohsakaSheep avatar Feb 09 '22 03:02 TohsakaSheep

Firstly, import the class: from pnp3d import PnP3D Then initialize it in the class get_model(nn.Module): self.pnp3d_module1= PnP3D(128) self.pnp3d_module2= PnP3D(256) Finally add something to def forward(self, xyz): l1_points = self.pnp3d_module1(l1_xyz, l1_points, 10) l2_points = self.pnp3d_module2(l2_xyz, l2_points, 10)

ShiQiu0419 avatar Feb 09 '22 04:02 ShiQiu0419

It always mentions "RuntimeError: selected index k out of range" for every value k, is there anything to do to fix this?

TohsakaSheep avatar Feb 09 '22 05:02 TohsakaSheep

It always mentions "RuntimeError: selected index k out of range" for every value k, is there anything to do to fix this?

Sorry that I have no idea about this issue, and it ran smoothly on my codebase as I just tested. It seems that the issue is about def knn or def get_neighbors, please carefully check the shapes of the searched tensors.

ShiQiu0419 avatar Feb 09 '22 06:02 ShiQiu0419

I placed PnP in the forward module of pointnet2_cls_ssg like this and it ran smoothly, is it the right usage of PnP module? ` def forward(self, xyz): B, _, _ = xyz.shape if self.normal_channel: norm = xyz[:, 3:, :] xyz = xyz[:, :3, :] else: norm = None l1_xyz, l1_points = self.sa1(xyz, norm) l2_xyz, l2_points = self.sa2(l1_xyz, l1_points) l3_xyz, l3_points = self.sa3(l2_xyz, l2_points) l1_points = self.pnp3d_module1(l1_xyz, l1_points, 10) # pnp3d l2_points = self.pnp3d_module2(l2_xyz, l2_points, 10) # pnp3d x = l3_points.view(B, 1024) x = self.drop1(F.relu(self.bn1(self.fc1(x)))) x = self.drop2(F.relu(self.bn2(self.fc2(x)))) x = self.fc3(x) x = F.log_softmax(x, -1)

    return x, l3_points`

TohsakaSheep avatar Feb 09 '22 13:02 TohsakaSheep

put the pnp3d module behind the corresponding sa module, like: l1_xyz, l1_points = self.sa1(xyz, norm) l1_points = self.pnp3d_module1(l1_xyz, l1_points, 10) # pnp3d l2_xyz, l2_points = self.sa2(l1_xyz, l1_points) l2_points = self.pnp3d_module2(l2_xyz, l2_points, 10) # pnp3d

ShiQiu0419 avatar Feb 10 '22 03:02 ShiQiu0419

It seems that PnP-3D module can also be used in the Part Segmentation task of PointNet++, I haven't seen this usage in the paper. Have you tried that?

TohsakaSheep avatar Feb 11 '22 11:02 TohsakaSheep

No, I haven't tried that dataset. You are encouraged to do so, but may spend some time on exploring the settings such as how many pnp3d modules to use or how many neighbors (k) to find.

ShiQiu0419 avatar Feb 11 '22 11:02 ShiQiu0419