一、spconv库安装
1、下载地址:https://github.com/traveller59/spconv/tree/v1.2.1
注意下载的spconv版本,默认下载2.×版本,安装后出现问题,又重新下载安装的1.2.1版本。
2、查看third_party文件下pybind11中是否存在文件,如果没有下载放到third_party文件夹下
git clone https://github.com/pybind/pybind11.git
cd pybind11
git checkout -b 3b1dbeb
3、编译spconv
cd spconv
python setup.py bdist_wheel
cd dist
pip install spconv_xxx_xxx.whl
4、检验spconv
是否安装成功,无报错即可
python
import spconv
二、代码编译
1、代码下载:
git clone https://github.com/open-mmlab/OpenPCDet.git
pip install -r requirements.txt
python setup.py develop
三、模型训练
1、数据准备
数据集格式
如果没有testing就把训练集一部分放到testing文件夹下,修改ImageSets中test.txt对应的文件索引。
2、训练集、测试集
运行下面的命令生成数据info:
python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml
3、开始训练:
python train.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml
多卡训练
CUDA_VISIBLE_DEVICES=0,1,2 python -m torch.distributed.launch --nproc_per_node=3 train.py --cfg_file cfgs/kitti_models/pointpillar_WJ.yaml --launcher pytorch
四、问题
1、open3d出现 “AttributeError: module 'open3d.open3d.geometry' has no attribute 'get_rotation_matrix_from_axis_angle'”错误
open3d 版本问题0.8.0升级为0.13.0
2、Import error: No module named mayavi 问题
sudo apt-get install mayavi2
接着出现 “ImportError: Could not import backend for traitsui. Make sure you have a suitable UI toolkit like PyQt/PySide or wxPython installed.”错误。
pip install pyside2 -i https://pypi.tuna.tsinghua.edu.cn/simple
3、ImportError: /data/3d_Object_detection/OpenPCDet-master/pcdet/ops/iou3d_nms/iou3d_nms_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c107complexIfEEEEPKNS_6detail12TypeMetaDataEv 问题
执行 python setup.py develop
重新编译openpcdet
出现下图即可
4、ModuleNotFoundError: No module named '__main__.train_utils'; '__main__' is not a package
import路径改成绝对路径:
5、KeyError: 'road_plane'
/OpenPCDet-master/tools/cfgs/dataset_configs/kitti_dataset.yaml,文件中use road plane设置为false。
/OpenPCDet-master/tools/cfgs/kitti_models/pv_rcnn.yaml,文件中use road plane设置为false。
6、AttributeError: 'VoxelGeneratorV2' object has no attribute '_full_mean'