环境:Ubuntu18.04+Nvidia Driver Version: 525.147.05+Cuda11.3+gcc 7.5.0
设备:服务器 Nvidia A40显卡
Pointnext代码地址:https://github.com/guochengqian/PointNeXt
注意:下载下来的zip里,openpoints文件夹是没有内容的,需要在https://github.com/guochengqian/openpoints 下载并解压到pointNext的openpoints文件夹里
论文地址: https://arxiv.org/abs/2206.04670
本文主要复现语义分割
第一步:先创建anaconda虚拟环境 pointnext
conda create -n pointnext python=3.9
第二步:用Pycharm打开Pointnext,配置好解释器
第三步:在终端激活虚拟环境并下载依赖
conda activate pointnext
souce install.sh
第四步:在终端运行examples/segmentation的main.py
python main.py
然后开始解决报错(不一定按顺序)
1.ModuleNotFoundError: No module named ‘yaml’
pip install pyyaml
2.ModuleNotFoundError: No module named ‘wandb’
pip install wandb
3.ModuleNotFoundError: No module named ‘openpoints.util’
openpoints文件夹是没有内容,需要在https://github.com/guochengqian/openpoints 下载并解压到pointNext的openpoints文件夹里
4.ModuleNotFoundError: No module named ‘torch’ 注意cuda和pytorch版本要对应
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch
5.ModuleNotFoundError: No module named ‘multimethod’
这个我不记得了 0.0 pip install multimethod 试一下吧
6.ModuleNotFoundError: No module named ‘shortuuid’
pip install shortuuid
7.ModuleNotFoundError: No module named ‘easydict’
pip install easydict
8.未找到pointnet2_batch_cuda文件的错误
cd openpoints/cpp/pointnet2_batch
python setup.py install
9.ModuleNotFoundError: No module named ‘torch_scatter’
打开 https://pytorch-geometric.com/whl/,找到对应pytorch和cuda版本的链接,
进去下载
在终端利用cd命令跳转到whl文件所在文件夹并下载
pip install torch_scatter-2.1.0+pt112cu113-cp39-cp39-linux_x86_64.whl
10.运行main.py文件,但是此时还是会有报错,因为该文件有一个命令行参数是必须的,而我们直接运行main文件则是无命令行参数,将必要命令行参数改成不必要,并且设置默认参数即可,如下所示:如果找不到pointnext-xl.yaml 用绝对路径
11.找不到数据集data/S3DIS/s3disfull
创建文件夹 要把s3dis数据集放到文件夹里面,cfgs/s3dis/default.yaml dataroot改为绝对路径
12.AttributeError: module ‘numpy’ has no attribute ‘long’
根据报错找到使用np.long的位置,将np.long替换为np.int64
13.ModuleNotFoundError: No module named ‘chamfer_dist’
cd openpoints/cpp/chamfer_dist
python setup.py install --user
第8点和第13点都在install.sh里找到解决办法
python examples/segmentation/main.py --cfg cfgs/s3dis/pointnext-xl.yaml
应该就只有这些了,复现完就马上写了
大功告成!!!!
测试:打开终端,运行
bash script/main_segmentation.sh cfgs/s3dis/pointnext-xl.yaml wandb.use_wandb=False mode=test --pretrained_path pretrained/s3dis/pointnext-xl/pointnext-xl-area5/checkpoint/pointnext-xl_ckpt_best.pth visualize=True
bash script/main_segmentation.sh cfgs/s3dis/pointnext-xl.yaml wandb.use_wandb=False mode=test --pretrained_path /home/admin815/PycharmProjects/PointNeXt-master/log/s3dis/s3dis-train-pointnext-xl-ngpus1-20240617-163328-gZHSSmA6PmwnxZJ9j4Eohu/checkpoint/s3dis-train-pointnext-xl-ngpus1-20240617-163328-gZHSSmA6PmwnxZJ9j4Eohu_ckpt_best.pth visualize=True
add visualize=True
to save segmentation results as .obj files
pretrained_path 改为之前训练后保存的best.pth的路径
结果:meshlab查看
参考:http://t.csdnimg.cn/yLezz 复现PointNext网络架构时,运行调试main.py
https://guochengqian.github.io/PointNeXt/examples/s3dis/