前言
刚开始接触OpenPCDet这个库,配置环境好久都不成功,后面看到这篇博文
【OpenPCDet】Kitti数据集下训练PointPillars并评估&可视化
给我提供了思路,本文主要记录一下安装过程中出现的错误
环境
ubuntu20.04+ CUDA Version: 11.5
安装torch
创建虚拟环境
conda create -n OpenPCDet python==3.8
激活环境
conda activate OpenPCDet
通过nvidia-smi
命令查看CUDA版本
然后在Pytorch
官网安装对应版本,我对应版本的指令为
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
安装pcdet
参照这一篇
OpenPCDet安装和快速演示
安装spconv
pip install spconv-cu113
安装完查看版本
spconv-cu113 2.1.21
后续跟着这篇博文安装即可
【OpenPCDet】Kitti数据集下训练PointPillars并评估&可视化
报错解决
错误1: kornia选择合适版本安装
后续可能会出现ModuleNotFoundError: No module named ‘kornia‘
提示
安装合适的kornia
版本,,当前最新是0.7.0,我这里是选择
pip install kornia==0.6.8
否则可能会出现错误
normalize the input quaternion
quaternion_norm: torch.Tensor = normalize_quaternion(quaternion)
HEREunpack the normalized quaternion components
‘quaternion_to_rotation_matrix’ is being compiled since it was called
from ‘quat_to_mat’ File
“/root/OpenPCDet/pcdet/datasets/argo2/argo2_utils/so3.py”, line 19
(…,3,3) 3D rotation matrices. “”" return
C.quaternion_to_rotation_matrix( quat_wxyz,
order=C.QuaternionCoeffOrder.WXYZ
HERE
)
Expected a value of type ‘float’ for argument ‘p’ but instead found type ‘int’.
错误2:AssertionError:assert img_file.exists()
image_info = {‘image_idx’: sample_idx, ‘image_shape’: self.get_image_shape(sample_idx)}
File “/projectdata/OpenPCDet/pcdet/datasets/kitti/kitti_dataset.py”, line 69, in get_image_shape
assert img_file.exists()
AssertionError
原因:kitti数据集划分有问题或文件出错
kiti dataset info
下面出现的这个问题应该也是数据集没有划分成功
File “train.py”, line 113, in main total_epochs=args.epochs File
“…/pcdet/datasets/init.py”, line 50, in build_dataloader dataset =
all[dataset_cfg.DATASET]( AttributeError: ‘EasyDict’ object has no
attribute ‘DATASET’
参考这个博客下载数据集
错误3:KeyError: ‘road_plane’
File “…/pcdet/datasets/augmentor/database_sampler.py”, line 372, in
add_sampled_boxes_to_scene
sampled_gt_boxes, data_dict[‘road_plane’], data_dict[‘calib’]
KeyError: ‘road_plane’
解决办法:
find tools/cfgs/*.yaml,
then change “USE_ROAD_PLANE: True” to “USE_ROAD_PLANE: False”
这里看你需要运行的yaml文件
补充:运行PointRCNN时对应的yaml没有这个选项
仔细查看后发现其基础配置是kitti_dataset.yaml
文件,更改这个即可
运行成功截图
参考
【OpenPCDet】Kitti数据集下训练PointPillars并评估&可视化
OpenPCDet安装和快速演示
spconv版本更迭导致的Bug:AttributeError: module ‘spconv‘ has no attribute ‘SparseModule‘