Learning3D:3维点云数据的深度学习现代库

Learning3D是一个开源的Python库,专注于3D点云数据的深度学习算法。该库提供了多种预训练模型,如PointNet、PPFNet等,支持的数据集包括ModelNet40,并涵盖了点云分类、分割、配准等多种任务。此外,还包含各种损失函数,如Chamfer Distance和Correspondence Loss。库的使用包括数据加载、模型创建和损失函数应用等步骤,适用于不同的3D深度学习场景。

Learning3D:3维点云数据的深度学习库

源链接:https://github.com/vinits5/learning3d

文档 | 博客 | 示例代码

Learning3D是一个开源库,支持处理3维数据的深度学习算法的开发。Learning3D有在python中目前效果好的深度神经网络。为了进一步开发,这里提供了模块化的代码。欢迎开源社区的贡献。

在Learning3D 可用的CV算法

序号任务算法
1分类PointNet, DGCNN, PPFNet, PointConv
2分割PointNet, DGCNN
3重建Point Completion Network (PCN)
4配准PointNetLK, PCRNet, DCP, PRNet, RPM-Net, DeepGMR
5Flow EstimationFlowNet3D
6Inlier EstimationMaskNet

可使用的预训练模型

  1. PointNet
  2. PCN
  3. PointNetLK
  4. PCRNet
  5. DCP
  6. PRNet
  7. FlowNet3D
  8. RPM-Net (clean-trained.pth, noisy-trained.pth, partial-pretrained.pth)
  9. DeepGMR
  10. PointConv (通过这个 链接下载)
  11. MaskNet

可使用的数据集

  1. ModelNet40

可使用的损失函数

  1. 分类损失函数(交叉熵(Cross Entropy))
  2. 配准损失函数 (FrobeniusNormLoss, RMSEFeaturesLoss)
  3. 距离损失函数(Chamfer Distance, Earth Mover’s Distance)
  4. 对应关系损失函数(Correspondence Loss) (基于这篇文章)

技术细节

支持的系统

  1. Ubuntu 16.04
  2. Ubuntu 18.04
  3. Linux Mint

开发环境

  1. CUDA 10.0 或更高的版本
  2. Pytorch 1.3 或更高的版本

如何使用这个库

请注意:要Clone 这个库到你的项目里,请不要将自己的代码添加到**learning3d**

  1. 所有的网络都定义在models这个模块中;
  2. 所有的损失函数都定义在losses这个模块中;
  3. Data loaders 提前定义在data_utils/dataloaders.py这个文件中;
  4. 所有的预训练模型都在learning3d/pretrained 文件夹之中;

文档

B: 批量大小(Batch Size), N: 点的数量(No. of points ), C: 通道(Channels.)

Point Embedding Networks的使用:

from learning3d.models import PointNet, DGCNN, PPFNet
pn = PointNet(emb_dims=1024, input_shape=‘bnc’, use_bn=False)
dgcnn = DGCNN(emb_dims=1024, input_shape=‘bnc’)
ppf = PPFNet(features=[‘ppf’, ‘dxyz’, ‘xyz’], emb_dims=96, radius=‘0.3’, num_neighbours=64)

序号变量数据类型大小(Shape)可选择的值(Choices)变量含义(Use)
1.emb_dimsInteger标量1024, 512每个点的特征向量的大小
2.input_shapeString-‘bnc’, ‘bcn’输入点云的形式(shape)
3.outputtensorBxCxN-每个点的高维embeddings
4.featuresList of Strings-[‘ppf’, ‘dxyz’, ‘xyz’]使用各种各样的特征
5.radiusFloat标量0.3features 计算局部特征的聚类半径
6.num_neighboursInteger标量64每个聚类中的最大点数
Classification / Segmentation Network的使用:

from learning3d.models import Classifier, PointNet, Segmentation
classifier = Classifier(feature_model=PointNet(), num_classes=40)
seg = Segmentation(feature_model=PointNet(), num_classes=40)

序号变量数据类型大小(Shape)可选择的值(Choices)变量含义(Use)
1.feature_modelObject-PointNet / DGCNN点云的embedding 网络
2.num_classesInteger标量10, 40分类物品的类别数量
3.outputtensor分类: Bx40, 分割: BxNx4010, 40每个类别的概率或每个点云的概率
Registration Networks的使用:

from learning3d.models import PointNet, PointNetLK, DCP, iPCRNet, PRNet, PPFNet, RPMNet
pnlk = PointNetLK(feature_model=PointNet(), delta=1e-02, xtol=1e-07, p0_zero_mean=True, p1_zero_mean=True, pooling=‘max’)
dcp = DCP(feature_model=PointNet(), pointer_=‘transformer’, head=‘svd’)
pcrnet = iPCRNet(feature_moodel=PointNet(), pooling=‘max’)
rpmnet = RPMNet(feature_model=PPFNet())
deepgmr = DeepGMR(use_rri=True, feature_model=PointNet(), nearest_neighbors=20)

序号变量数据类型可选择的值(Choices)变量含义(Use)使用的算法
1.feature_modelObjectPointNet / DGCNN点云的 embedding 网络PointNetLK
2.deltaFloatScalar计算近似雅可比(approximate jacobian)的参数PointNetLK
3.xtolFloatScalar迭代数(Check tolerance to stop iterations )PointNetLK
4.p0_zero_meanBooleanTrue/False从模板点云中减去平均值PointNetLK
5.p1_zero_meanBooleanTrue/False从源点云中减去平均值PointNetLK
6.poolingString‘max’ / ‘avg’用于获取全局特征向量的池化层(Pooling)类型PointNetLK
7.pointer_String‘transformer’ / ‘identity’使用Transformer/AttentionDCP
8.headString‘svd’ / ‘mlp’选择估计配准的参数DCP
9.use_rriBooleanTrue/False使用最近邻估计点云特征DeepGMR
10.nearest_neighboresInteger20/any integer用多少个最近邻来估计DeepGMR
Inlier Estimation Network (MaskNet)的使用:

from learning3d.models import MaskNet, PointNet
masknet = MaskNet(feature_model=PointNet(), is_training=True)

序号变量数据类型可选择的值(Choices)变量含义(Use)
1.feature_modelObjectPointNet / DGCNNPoint cloud embedding network
2.is_trainingBooleanTrue / FalseSpecify if the network will undergo training or testing
Point Completion Network的使用:

from learning3d.models import PCN
pcn = PCN(emb_dims=1024, input_shape=‘bnc’, num_coarse=1024, grid_size=4, detailed_output=True)

序号变量数据类型可选择的值(Choices)可选择的值(Choices)
1.emb_dimsInteger1024, 512每个点的特征向量大小
2.input_shapeString‘bnc’ / ‘bcn’输入点云的形式(shape)
3.num_coarseInteger1024输出点云的形式(shape)
4.grid_sizeInteger4, 8, 16用于生成详细输出(detailed output)的网格(grid)大小
5.detailed_outputBooleanTrue / False是否用额外模块去创建详细输出detailed output)点云
PointConv的使用:

使用以下作者预训练好的模型来创建

from learning3d.models import create_pointconv
PointConv = create_pointconv(classifier=True, pretrained=‘path of checkpoint’)
ptconv = PointConv(emb_dims=1024, input_shape=‘bnc’, input_channel_dim=6, classifier=True)

或者 像下面一样 用自己的PointConv模型来创建

PointConv = create_pointconv(classifier=False, pretrained=None)
ptconv = PointConv(emb_dims=1024, input_shape=‘bnc’, input_channel_dim=3, classifier=True)

PointConv 的变量是一个类,使用者可以使用它去创建一个子类来重载*create_classifiercreate_structure* 方法去改变PointConv的网络架构。

序号变量数据类型可选择的值(Choices)变量含义(Use)
1.emb_dimsInteger1024, 512每个点的特征向量的大小
2.input_shapeString‘bnc’ / ‘bcn’输入点云的形式(shape)
3.input_channel_dimInteger3/6点云是否拥有xyz维度,法向量维度和颜色维度
4.classifierBooleanTrue / False是否使用PointConv来分类
5.pretrainedBooleanString给定预训练分类模型的路径(仅供作者所给出的权重使用)
Flow Estimation Network的使用:

from learning3d.models import FlowNet3D
flownet = FlowNet3D()

Data Loaders的使用:

from learning3d.data_utils import ModelNet40Data, ClassificationData, RegistrationData, FlowData
modelnet40 = ModelNet40Data(train=True, num_points=1024, download=True)
classification_data = ClassificationData(data_class=ModelNet40Data())
registration_data = RegistrationData(algorithm=‘PointNetLK’, data_class=ModelNet40Data(), partial_source=False, partial_template=False, noise=False)
flow_data = FlowData()

序号变量数据类型可选择的值(Choices)变量含义(Use)
1.trainBooleanTrue / False分数据给训练/测试集
2.num_pointsInteger1024每个点云里点的数量
3.downloadBooleanTrue / False如果数据不存在会去下载
4.data_classObject-指定所使用的数据集
5.algorithmString‘PointNetLK’, ‘PCRNet’, ‘DCP’, ‘iPCRNet’配准的算法
6.partial_sourceBooleanTrue / False创造源点云的一部分
7.partial_templateBooleanTrue / False创造模板点云的一部分
8.noiseBooleanTrue / False为源点云添加噪声
使用自己的数据:

from learning3d.data_utils import UserData
dataset = UserData(application, data_dict)

序号应用的领域需要的键对应的值
1.‘classification’‘pcs’Point Clouds (BxNx3)
‘labels’Ground Truth Class Labels (BxN)
2.‘registration’‘template’Template Point Clouds (BxNx3)
‘source’Source Point Clouds (BxNx3)
‘transformation’Ground Truth Transformation (Bx4x4)
3.‘flow_estimation’‘frame1’Point Clouds (BxNx3)
‘frame2’Point Clouds (BxNx3)
‘flow’Ground Truth Flow Vector (BxNx3)
损失函数的使用:

from learning3d.losses import RMSEFeaturesLoss, FrobeniusNormLoss, ClassificationLoss, EMDLoss, ChamferDistanceLoss, CorrespondenceLoss
rmse = RMSEFeaturesLoss()
fn_loss = FrobeniusNormLoss()
classification_loss = ClassificationLoss()
emd = EMDLoss()
cd = ChamferDistanceLoss()
corr = CorrespondenceLoss()

序号损失函数的类型含义(Use)
1.RMSEFeaturesLoss用于求 两点云全局特征向量的均方根(RSM)的值
2.FrobeniusNormLoss用于求 两变换矩阵的frobenius 范数
3.ClassificationLoss用于计算交叉熵损失
4.EMDLoss求两给定点云的Earth Mover 距离
5.ChamferDistanceLoss求两给定点云的Chamfer 距离
6.CorrespondenceLoss使用每个源点的 预测对应关系(correspondence)和ground truth 对应关系 计算交叉熵损失

示例代码的运行:

  1. examples文件夹复制到learning3d文件夹外的文件夹
  2. 然后运行文件(如 python test_pointnet.py)
  • 文件目录\文件地址
    • learning3d
    • test_pointnet.py

参考文献:

  1. PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation
  2. Dynamic Graph CNN for Learning on Point Clouds
  3. PPFNet: Global Context Aware Local Features for Robust 3D Point Matching
  4. PointConv: Deep Convolutional Networks on 3D Point Clouds
  5. PointNetLK: Robust & Efficient Point Cloud Registration using PointNet
  6. PCRNet: Point Cloud Registration Network using PointNet Encoding
  7. Deep Closest Point: Learning Representations for Point Cloud Registration
  8. PRNet: Self-Supervised Learning for Partial-to-Partial Registration
  9. FlowNet3D: Learning Scene Flow in 3D Point Clouds
  10. PCN: Point Completion Network
  11. RPM-Net: Robust Point Matching using Learned Features
  12. 3D ShapeNets: A Deep Representation for Volumetric Shapes
  13. DeepGMR: Learning Latent Gaussian Mixture Models for Registration
  14. CMU: Correspondence Matrices are Underrated
  15. MaskNet: A Fully-Convolutional Network to Estimate Inlier Points
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值