pnp-3d
pnp-3d copied to clipboard
How to use it in detail?
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
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)
It always mentions "RuntimeError: selected index k out of range" for every value k, is there anything to do to fix this?
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.
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`
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
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?
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.