前言
环境 cuda 11.3 python 3.8 ubuntu2004
一、cuda环境检测
ylh@y:~/code_ws/OpenPCDet/tools$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:15:46_PDT_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0
二、创建conda环境
conda create -n pcdet python=3.8
三、安装依赖
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install av2==0.1.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install kornia==0.6.8
pip install spconv-cu113
pip install open3d -i https://pypi.tuna.tsinghua.edu.cn/simple
四、编译安装pcdet
使用的是master分支commit 为8cacccec11db6f59bf6934600c9a175dae254806
版本
git clone https://github.com/open-mmlab/OpenPCDet.git
python setup.py develop
五、数据预处理
python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml
六、训练测试
cd tools/
python train.py --cfg_file ./cfgs/kitti_models/pointpillar.yaml --batch_size 1 --epochs 50
注意pointpillar.yaml中的USE_ROAD_PLANE设置为False,否则demo会出错
七、推理测试
cd tools/
python demo.py --cfg_file ../tools/cfgs/kitti_models/pointpillar.yaml --ckpt ../tools/pth/kitti/pointpillar_7728.pth --data_path ../data/kitti/testing/velodyne/000517.bin
八、小结
安装时,务必注意python 3.8、cuda 11.3,贴出来的依赖版本均为验证可行。
附带一些报错记录
1、训练报错 KeyError: 'LLVMPY_AddSymbol
原因:LLV找了本地的gcc9版本,而本地gcc版本没有GLIBCXX_3.4.29
解决方式,设置环境变量,加载conda环境中的gcc11版本(涵盖GLIBCXX_3.4.29)
export LD_LIBRARY_PATH=/home/ylh/software/miniconda3/lib:$LD_LIBRARY_PATH
注意:记得检查个人conda环境是否安装了对应gcc版本,根据个人环境设置环境变量
torch版本安装参考
###################
好记性不如烂笔头
积跬步期千里