1、P2B整体框图
2、forward函数(输入template:[batch,512,3];search:[batch,1024,3])
2.1、输入通过PointNet++得到seeds,以template为例,流程如下。同理search的输出为[batch,128,3] 、[batch,256,128],其中3(xyz)、256是通道数,128是group数。
- Layer1、Layer2、Layer3结构如下(方框代表每层的输出1和输出2):
2.2、target-specific特征增强(M1=64,M2=128)
2.3、voting:Potential target centers
2.4、classifying:seed-wise targetness score
target-specific特征[batch,256,M2]经过3层conv1d得到(batch,1,M2)->(batch,M2)->sigmod->(batch,M2)作为整个网络的输出1:estimation_cla
2.5、cluster of potentiao target centers:vote_aggregation
2.6、Verification
estimation_boxs = torch.cat((proposal_offsets[:,0:3,:]+center_xyzs.transpose(1, 2).contiguous(),proposal_offsets[:,3:5,:]),dim=1)得(batch,5,64)作为整个网络的输出3
3、Loss分析
#print(object_point_set.shape) #template (24,512,3)
# print(label_point_set.shape) #search (24,1024,3)
# print(label_cla.shape) #(24,128)
# print(label_reg.shape) #(24,128,4)
3.1、loss_cla
loss_cla = nn.BCEWithLogitsLoss(estimation_cla,label_cla)
estimation_cla是输出1,尺寸为(batch,M2),label_cla的尺寸同样为(batch,M2)。label_cla直接取自点云数据的前M2个点云的label_cla。
3.2、loss_reg
loss_reg = nn.SmoothL1Loss(estimation_reg, label_reg[:,:,0:3]) 前3位代表是xyz,第4位是随机offset
loss_reg = (loss_reg.mean(2) * label_cla).sum()/(label_cla.sum()+1e-06) 只挑选label_cla为正样本的训练。
3.3、loss_objective
dist = torch.sum((center_xyz - label_reg[:,0:64,0:3])**2, dim=-1)
# print(dist.shape) #(24,64)
dist = torch.sqrt(dist+1e-6)
B = dist.size(0) #24
K = 64
objectness_label = torch.zeros((B,K), dtype=torch.float).cuda() #(24,64)
objectness_mask = torch.zeros((B,K)).cuda() #(24,64)
objectness_label[dist<0.3] = 1 #三维马氏距离小于0.3为正样本,其他为负样本
objectness_mask[dist<0.3] = 1
objectness_mask[dist>0.6] = 1 #采样<0.3和>0.6的为分类分数的正样本proposal-wise targetness score
# >0.6是希望更快速的得到一些正样本的proposal,即dist小->center_xyz与实际的位置接近->estimation_reg与实际的位置接近
loss_objective = criterion_objective(estimation_box[:,:,4], objectness_label) #对estimation_box[:,:,4]每个数取了ln
# print(estimation_box[:,:,4][0])
# print(loss_objective[0])
# print(loss_objective.shape) #(24,64)
loss_objective = torch.sum(loss_objective * objectness_mask)/(torch.sum(objectness_mask)+1e-6)
损失输入为网络输出3estimation_box的第五位,代表proposal-wise targetness score,label根据网络输出4与真实的位置距离得到。
3.4、loss_box
loss_box = criterion_box(estimation_box[:,:,0:4],label_reg[:,0:64,:])
loss_box = (loss_box.mean(2) * objectness_label).sum()/(objectness_label.sum()+1e-06) #只训练正样本