环境配置
Ubuntu 18.04
CUDA 11.6
python 3.7
pytorch 1.13.1+cu116
一、下载
论文地址:PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space (neurips.cc)
github地址(pytorch版本):yanx27/Pointnet_Pointnet2_pytorch: PointNet and PointNet++ implemented by pytorch (pure python) and on ModelNet, ShapeNet and S3DIS. (github.com)
二、环境配置
conda create -n pointnet2 python=3.7
conda activate pointnet2
pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
pip install tqdm
三、数据准备
下载 Stanford3dDataset_v1.2_Aligned_Version数据集,网盘可参考
S3DIS场景点云数据集_s3dis/stanford3ddataset_v1.2_aligned_version-CSDN博客
放在data/s3dis/目录下,之后执行以下命令
cd data_utils
python collect_indoor3d_data.py
cd ../
之后处理好的数据将被放在data/s3dis/stanford_indoor3d目录下。
【预处理后数据解析】:
stanford_indoor3d/*.npy:内部为一个数组,shape为(N, 7),分别是xyzrgb以及语义label
四、代码分析
Dataset——S3DISDataset类
Dataloader——torch.utils.data.DataLoader类
Model——models/pointnet2_sem_seg_msg.py中的get_model类
Optimizer——torch.optim.Adam类或torch.optim.SGD
Scheduler——无
Loss——torch.nn.functional.null_loss【softmax+null_loss可构成CrossEntropy】
五、训练流程分析
1.训练命令使用
python train_semseg.py --model pointnet2_sem_seg --test_area 5 --log_dir pointnet2_sem_seg
2.训练流程分析
本项目是作者部署众多项目中,最为友好的一个项目,环境配置极快,代码结构清晰,没有用到过多的外部工具库。
六、推理流程分析
python test_semseg.py --log_dir pointnet2_sem_seg --test_area 5 --visual
七、参考资料
1.sample_and_group函数和samle_and_group_all函数详解
Pointnet++代码详解(五):sample_and_group函数和samle_and_group_all函数_sample and group-CSDN博客
2.关于PointNet & PointNet++的理论知识
论文小结:PointNet & PointNet++_pointnet和pointnet++的共同点-CSDN博客
3.Pointnet++网络结构结合代码解释