Python 官方文档:入门教程 => 点击学习
文章目录 点云补全概念点云补全(PF-Net)点云补全网络模型骨骼点逐级恢复点云最远点采样特征提取分层预测Chamfer DistanceGANBCELoss损失模块 点云补全项目应
点云补全就是希望基于观察到的残缺不全的点云生成完整的 3D 点云。由于扫描或者距离的原因导致点云局部缺失,对其进行补全,传统算法可能会补不完整,也可能会补的过于完整。
今天这里要讲的是PF-Net: Point Fractal Network for 3D Point Cloud Completion,整体网络模型:
PF-Net特征提取代码实现如下:
def forward(self,x): print(x.shape) x = torch.unsqueeze(x,1) print(x.shape) x = F.relu(self.bn1(self.conv1(x))) print(x.shape) x = F.relu(self.bn2(self.conv2(x))) print(x.shape) x_128 = F.relu(self.bn3(self.conv3(x))) print(x_128.shape) x_256 = F.relu(self.bn4(self.conv4(x_128))) x_512 = F.relu(self.bn5(self.conv5(x_256))) x_1024 = F.relu(self.bn6(self.conv6(x_512))) print(x_1024.shape) x_128 = torch.squeeze(self.maxpool(x_128),2) print(x_128.shape) x_256 = torch.squeeze(self.maxpool(x_256),2) x_512 = torch.squeeze(self.maxpool(x_512),2) x_1024 = torch.squeeze(self.maxpool(x_1024),2) print(x_1024.shape) L = [x_1024,x_512,x_256,x_128] x = torch.cat(L,1) print(x.shape) return x
PF-Net分层预测代码实现如下:
def forward(self,x): print(np.array(x).shape) x = self.latentfeature(x) print(x.shape) x_1 = F.relu(self.fc1(x)) #1024 print(x_1.shape) x_2 = F.relu(self.fc2(x_1)) #512 print(x_2.shape) x_3 = F.relu(self.fc3(x_2)) #256 print(x_3.shape) pc1_feat = self.fc3_1(x_3) print(pc1_feat.shape) pc1_xyz = pc1_feat.reshape(-1,64,3) #64x3 center1 print(pc1_xyz.shape) pc2_feat = F.relu(self.fc2_1(x_2)) print(pc2_feat.shape) pc2_feat = pc2_feat.reshape(-1,128,64) print(pc2_feat.shape) pc2_xyz =self.conv2_1(pc2_feat) #6x64 center2 print(pc2_xyz.shape) pc3_feat = F.relu(self.fc1_1(x_1)) print(pc3_feat.shape) pc3_feat = pc3_feat.reshape(-1,512,128) print(pc3_feat.shape) pc3_feat = F.relu(self.conv1_1(pc3_feat)) print(pc3_feat.shape) pc3_feat = F.relu(self.conv1_2(pc3_feat)) print(pc3_feat.shape) pc3_xyz = self.conv1_3(pc3_feat) #12x128 fine print(pc3_xyz.shape) pc1_xyz_expand = torch.unsqueeze(pc1_xyz,2) print(pc1_xyz_expand.shape) pc2_xyz = pc2_xyz.transpose(1,2) print(pc2_xyz.shape) pc2_xyz = pc2_xyz.reshape(-1,64,2,3) print(pc2_xyz.shape) pc2_xyz = pc1_xyz_expand+pc2_xyz print(pc2_xyz.shape) pc2_xyz = pc2_xyz.reshape(-1,128,3) print(pc2_xyz.shape) pc2_xyz_expand = torch.unsqueeze(pc2_xyz,2) print(pc2_xyz_expand.shape) pc3_xyz = pc3_xyz.transpose(1,2) print(pc3_xyz.shape) pc3_xyz = pc3_xyz.reshape(-1,128,int(self.crop_point_num/128),3) print(pc3_xyz.shape) pc3_xyz = pc2_xyz_expand+pc3_xyz print(pc3_xyz.shape) pc3_xyz = pc3_xyz.reshape(-1,self.crop_point_num,3) print(pc3_xyz.shape) return pc1_xyz,pc2_xyz,pc3_xyz #center1 ,center2 ,fine
BCELoss模块代码实现如下:
import mathr11 = 0 * math.log(0.8707) + (1-0) * math.log((1 - 0.8707))r12 = 1 * math.log(0.7517) + (1-1) * math.log((1 - 0.7517))r13 = 1 * math.log(0.8162) + (1-1) * math.log((1 - 0.8162))r21 = 1 * math.log(0.3411) + (1-1) * math.log((1 - 0.3411))r22 = 1 * math.log(0.4872) + (1-1) * math.log((1 - 0.4872))r23 = 1 * math.log(0.6815) + (1-1) * math.log((1 - 0.6815))r31 = 0 * math.log(0.4847) + (1-0) * math.log((1 - 0.4847))r32 = 0 * math.log(0.6589) + (1-0) * math.log((1 - 0.6589))r33 = 0 * math.log(0.5273) + (1-0) * math.log((1 - 0.5273))r1 = -(r11 + r12 + r13) / 3#0.8447112733378236r2 = -(r21 + r22 + r23) / 3#0.7260397266631787r3 = -(r31 + r32 + r33) / 3#0.8292933181294807bceloss = (r1 + r2 + r3) / 3 print(bceloss)
判别模块代码实现如下:
def forward(self, x): x = F.relu(self.bn1(self.conv1(x))) x_64 = F.relu(self.bn2(self.conv2(x))) x_128 = F.relu(self.bn3(self.conv3(x_64))) x_256 = F.relu(self.bn4(self.conv4(x_128))) x_64 = torch.squeeze(self.maxpool(x_64)) x_128 = torch.squeeze(self.maxpool(x_128)) x_256 = torch.squeeze(self.maxpool(x_256)) Layers = [x_256,x_128,x_64] x = torch.cat(Layers,1) x = F.relu(self.bn_1(self.fc1(x))) x = F.relu(self.bn_2(self.fc2(x))) x = F.relu(self.bn_3(self.fc3(x))) x = self.fc4(x) return x
如果需要本文完整代码,以上算法论文或者点云数据资源的小伙伴可以私信我哦!
来源地址:https://blog.csdn.net/denny_data/article/details/129472080
--结束END--
本文标题: 点云补全算法汇总
本文链接: https://lsjlt.com/news/399939.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0