I am handle 3d point cloud.The data has type as: xyz intensity.I just use the xyz information in a pointnet model.It works.But I wonder how to apply ‘intensity’ in pointnet. The definition of the network ispointnet
class PointNetDenseCls(nn.Module):
def __init__(self, num_points = 10000, k = 8):
super(PointNetDenseCls, self).__init__()
self.num_points = num_points
self.k = k
self.feat = PointNetfeat(num_points, global_feat=False)
self.conv1 = torch.nn.Conv1d(1088, 512, 1)
self.conv2 = torch.nn.Conv1d(512, 256, 1)
self.conv3 = torch.nn.Conv1d(256, 128, 1)
self.conv4 = torch.nn.Conv1d(128, self.k, 1)
self.bn1 = nn.BatchNorm1d(512)
self.bn2 = nn.BatchNorm1d(256)
self.bn3 = nn.BatchNorm1d(128)
def forward(self, x):
batchsize = x.size()[0]
x, trans = self.feat(x)
x = F.relu(self.bn1(self.conv1(x)))
x = F.relu(self.bn2(self.conv2(x)))
x = F.relu(self.bn3(self.conv3(x)))
x = self.conv4(x)
x = x.transpose(2,1).contiguous()
x = F.log_softmax(x.view(-1,self.k), dim=-1)
x = x.view(batchsize, self.num_points, self.k)
return x, trans
I dont want to change the extracted features.May I add a new parameter in forward and combine the result x with intensity?just like that:
def forward(self, x,intensity):
batchsize = x.size()[0]
x, trans = self.feat(x)
x = F.relu(self.bn1(self.conv1(x)))
x = F.relu(self.bn2(self.conv2(x)))
x = F.relu(self.bn3(self.conv3(x)))
x = self.conv4(x)
x = x.transpose(2,1).contiguous()
x = F.log_softmax(x.view(-1,self.k), dim=-1)
x = somennlayer(x,intensity)
x = x.view(batchsize, self.num_points, self.k)
return x, trans
Is there any layer in pytorch to structure the relationship between the two parameters?