# Pointnet_Pointnet2_pytorch **Repository Path**: ai-models-cn/Pointnet_Pointnet2_pytorch ## Basic Information - **Project Name**: Pointnet_Pointnet2_pytorch - **Description**: PointNet 与 PointNet++ 的标准实现,及中文化注释。 - **Primary Language**: Python - **License**: MIT - **Default Branch**: cn-pytorch1.8.0 - **Homepage**: https://github.com/yanx27/Pointnet_Pointnet2_pytorch - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2024-01-19 - **Last Updated**: 2026-01-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PointNet 与 PointNet++ 的 PyTorch 实现 这个仓库是[PointNet](http://openaccess.thecvf.com/content_cvpr_2017/papers/Qi_PointNet_Deep_Learning_CVPR_2017_paper.pdf) 和 [PointNet++](http://papers.nips.cc/paper/7095-pointnet-deep-hierarchical-feature-learning-on-point-sets-in-a-metric-space.pdf) 的 PyTorch 实现。 ## 更新 **2021/03/27:** (1) 为语义分割发布预训练模型,其中 PointNet++ 可以获得 **53.5\%** mIoU. (2) 发布分类和部件分割的预训练模型在 `log/` 目录中 **2021/03/20:** 更新用于分类的代码 (1) 增加代码用于训练 **ModelNet10** 数据集,使用配置 ``--num_category 10``. (2) 增强代码用于在 CPU 上执行,使用配置 ``--use_cpu``. (3) 增加代码用于离线数据处理,加快训练速度,使用配置 ``--process_data``. (4) 增加代码用于训练均匀采样,使用配置 ``--use_uniform_sample``. **2019/11/26:** (1) 修改先前代码中的部分错误,增加数据增强的技巧。现在分类仅通过1024个点就可以得到 **92.8\%**! (2) 增加测试代码,包括分类和分割,以及语义分割的可视化。 (3) 组织所有的模型到 `./models` 目录中方便使用。 ## 安装 最新代码测试在 Ubuntu 16.04, CUDA10.1, PyTorch 1.6 and Python 3.7: ```shell conda install pytorch==1.6.0 cudatoolkit=10.1 -c pytorch ``` ## 分类 (ModelNet10/40) ### 数据准备(分类) 下载对齐数据 **ModelNet** [here](https://shapenet.cs.stanford.edu/media/modelnet40_normal_resampled.zip) 并且保存在 `data/modelnet40_normal_resampled/`. ### 运行(分类) 下面的代码可以运行在不同的模式下: * 如果需要离线处理数据,可以在第一次运行时使用 `--process_data` 。也可以下载预处理数据 [here](https://drive.google.com/drive/folders/1_fBYbDO3XSdRt3DSbEBe41r5l9YpIGWF?usp=sharing) 并且保存在 `data/modelnet40_normal_resampled/`. * 如果需要训练 ModelNet10,可以使用 `--num_category 10`. ```shell # ModelNet40 ## Select different models in ./models ## e.g., pointnet2_ssg 没有法向特征 python train_classification.py --model pointnet2_cls_ssg --log_dir pointnet2_cls_ssg python test_classification.py --log_dir pointnet2_cls_ssg ## e.g., pointnet2_ssg 增加法向特征 python train_classification.py --model pointnet2_cls_ssg --use_normals --log_dir pointnet2_cls_ssg_normal python test_classification.py --use_normals --log_dir pointnet2_cls_ssg_normal ## e.g., pointnet2_ssg 基于均匀采样 python train_classification.py --model pointnet2_cls_ssg --use_uniform_sample --log_dir pointnet2_cls_ssg_fps python test_classification.py --use_uniform_sample --log_dir pointnet2_cls_ssg_fps # ModelNet10 ## 与 ModelNet40 的配置相同,仅使用 --num_category 10 ## e.g., pointnet2_ssg 没有法向特征 python train_classification.py --model pointnet2_cls_ssg --log_dir pointnet2_cls_ssg --num_category 10 python test_classification.py --log_dir pointnet2_cls_ssg --num_category 10 ``` ### 性能(分类) | Model | Accuracy | |--|--| | PointNet (Official) | 89.2| | PointNet2 (Official) | 91.9 | | PointNet (Pytorch without normal) | 90.6| | PointNet (Pytorch with normal) | 91.4| | PointNet2_SSG (Pytorch without normal) | 92.2| | PointNet2_SSG (Pytorch with normal) | 92.4| | PointNet2_MSG (Pytorch with normal) | **92.8**| ## 部件分割 (ShapeNet) ### 数据准备(部件分割) 下载对齐的数据 **ShapeNet** [here](https://shapenet.cs.stanford.edu/media/shapenetcore_partanno_segmentation_benchmark_v0_normal.zip) 保存在 `data/shapenetcore_partanno_segmentation_benchmark_v0_normal/`. ### 执行(部件分割) ```shell ## Check model in ./models ## e.g., pointnet2_msg python train_partseg.py --model pointnet2_part_seg_msg --normal --log_dir pointnet2_part_seg_msg python test_partseg.py --normal --log_dir pointnet2_part_seg_msg ``` ### 性能(部件分割) | Model | Inctance avg IoU| Class avg IoU| |--|--|--| |PointNet (Official)|83.7|80.4| |PointNet2 (Official)|85.1|81.9| |PointNet (Pytorch)|84.3|81.1| |PointNet2_SSG (Pytorch)|84.9|81.8| |PointNet2_MSG (Pytorch)|**85.4**|**82.5**| ## 语义分割 (S3DIS) ### 数据准备(语义分割) 下载三维室内解析数据集 ( 3D indoor parsing dataset,**S3DIS**) [here](http://buildingparser.stanford.edu/dataset.html) 保存在 `data/s3dis/Stanford3dDataset_v1.2_Aligned_Version/`. ```shell cd data_utils python collect_indoor3d_data.py ``` 处理数据保存在 `data/stanford_indoor3d/`. ### 执行(语义分割) ```shell ## Check model in ./models ## e.g., pointnet2_ssg python train_semseg.py --model pointnet2_sem_seg --test_area 5 --log_dir pointnet2_sem_seg python test_semseg.py --log_dir pointnet2_sem_seg --test_area 5 --visual ``` 可视化结果保存在 `log/sem_seg/pointnet2_sem_seg/visual/` 并且可以使用 [MeshLab](http://www.meshlab.net/) 可视化 .obj 文件 ### 性能(语义分割) |Model | Overall Acc |Class avg IoU | Checkpoint| |--|--|--|--| | PointNet (Pytorch) | 78.9 | 43.7| [40.7MB](log/sem_seg/pointnet_sem_seg) | | PointNet2_ssg (Pytorch) | **83.0** | **53.5**| [11.2MB](log/sem_seg/pointnet2_sem_seg) | ## 可视化 ### 使用 show3d_balls.py ```shell ## build C++ code for visualization cd visualizer bash build.sh ## run one example python show3d_balls.py ``` ![可视化结果](/visualizer/pic.png) ### 使用 MeshLab ![可视化结果](/visualizer/pic2.png) ## 参考文献 1. [halimacc/pointnet3](https://github.com/halimacc/pointnet3) 1. [fxia22/pointnet.pytorch](https://github.com/fxia22/pointnet.pytorch) 1. [charlesq34/PointNet](https://github.com/charlesq34/pointnet) 1. [charlesq34/PointNet++](https://github.com/charlesq34/pointnet2) ## 引用 如果这个仓库在你的研究中有用,请考虑引用: ```bib @article{Pytorch_Pointnet_Pointnet2, Author = {Xu Yan}, Title = {Pointnet/Pointnet++ Pytorch}, Journal = {https://github.com/yanx27/Pointnet_Pointnet2_pytorch}, Year = {2019} } ``` ```bib @InProceedings{yan2020pointasnl, title={PointASNL: Robust Point Clouds Processing using Nonlocal Neural Networks with Adaptive Sampling}, author={Yan, Xu and Zheng, Chaoda and Li, Zhen and Wang, Sheng and Cui, Shuguang}, journal={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}, year={2020} } ``` ```bib @InProceedings{yan2021sparse, title={Sparse Single Sweep LiDAR Point Cloud Segmentation via Learning Contextual Shape Priors from Scene Completion}, author={Yan, Xu and Gao, Jiantao and Li, Jie and Zhang, Ruimao, and Li, Zhen and Huang, Rui and Cui, Shuguang}, journal={AAAI Conference on Artificial Intelligence ({AAAI})}, year={2021} } ``` ```bib @InProceedings{yan20222dpass, title={2DPASS: 2D Priors Assisted Semantic Segmentation on LiDAR Point Clouds}, author={Xu Yan and Jiantao Gao and Chaoda Zheng and Chao Zheng and Ruimao Zhang and Shuguang Cui and Zhen Li}, year={2022}, journal={ECCV} } ``` ## 使用这个代码库选择项目 * [PointConv: Deep Convolutional Networks on 3D Point Clouds, CVPR'19](https://github.com/Young98CN/pointconv_pytorch) * [On Isometry Robustness of Deep 3D Point Cloud Models under Adversarial Attacks, CVPR'20](https://github.com/skywalker6174/3d-isometry-robust) * [Label-Efficient Learning on Point Clouds using Approximate Convex Decompositions, ECCV'20](https://github.com/matheusgadelha/PointCloudLearningACD) * [PCT: Point Cloud Transformer](https://github.com/MenghaoGuo/PCT) * [PSNet: Fast Data Structuring for Hierarchical Deep Learning on Point Cloud](https://github.com/lly007/PointStructuringNet) * [Stratified Transformer for 3D Point Cloud Segmentation, CVPR'22](https://github.com/dvlab-research/stratified-transformer)