def forward(self, x):
batchsize = x.size()[0]
trans = self.stn(x) # regressing the transforming parameters using STN
x = x.transpose(2,1) # bz x 2048 x 3
x = torch.bmm(x, trans) # (bz x 2048 x 3) x (bz x 3 x 3)
x = x.transpose(2,1) # bz x 3 x 2048
x = F.relu(self.bn1(self.conv1(x)))
pointfeat = x # bz x 64 x 2048
x = F.relu(self.bn2(self.conv2(x))) # bz x 128 x 2048
x = self.bn3(self.conv3(x)) # bz x 1024 x 2048
x = self.mp1(x)
x = x.view(-1, 1024) # bz x 1024
if self.global_feat: # using global feats for classification
return x, trans
else:
x = x.view(-1, 1024, 1).repeat(1, 1, self.num_points)
return torch.cat([x, pointfeat], 1), trans
评论列表
文章目录