文章目录
https://xiaohu.blog.csdn.net/article/details/124515876
在进行训练之前
- 需要配置好Openpcdet的环境——Ubuntu18.04复现OpenPCDet
- 下载并组织好KITTI文件——KITTI数据集解析和可视化
一、数据预处理
生成数据pkl文件和gt_database文件夹
python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml
二、训练
2.1 模型训练
用于训练的文件在OpenPCDet-master/tools/train.py
cd tools
# 单卡训练
python train.py --cfg_file cfgs/kitti_models/pointpillar.yaml
# 多卡训练
CUDA_VISIBLE_DEVICES=5,6,7 python -m torch.distributed.launch --nproc_per_node=3 tools/train.py --cfg_file tools/cfgs/kitti_models/pointpillar.yaml --launcher pytorch
sh scripts/dist_train.sh 8 --cfg_file tools/cfgs/kitti_models/pointpillar.yaml
2.2 tensorBoard可视化
tensorBoard可视化
cd output/kitti_models/pointpillar/default/
tensorboard --logdir tensorboard/
然后远程连接服务器桌面,打开浏览器输入http://localhost:6006/
三、测试
运行test.py
脚本验证模型在测试集上的性能
cd tools
python test.py --cfg_file cfgs/kitti_models/pointpillar.yaml --batch_size 4 --ckpt ../output/kitti_models/pointpillar/default/ckpt/latest_model.pth
四、推理
cd tools
python demo.py --cfg_file cfgs/kitti_models/pointpillar.yaml --data_path ../data/kitti/testing/velodyne/000099.bin --ckpt ../output/kitti_models/pointpillar/default/ckpt/latest_model.pth
Debug 记录
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
- 问题描述
报错如下
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
- 寻找原因
- 在终端输入如下命令,开启debug模式
export QT_DEBUG_PLUGINS=1
- 然后再次之前运行报错的那条命令
python3 demo.py --cfg_file cfgs / kitti_models / pointpillars.yaml
debug报错记录如下
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/ubuntu/anaconda3/envs/openpcdet/bin/platforms" ...
Cannot load library /home/ubuntu/anaconda3/envs/openpcdet/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/ubuntu/anaconda3/envs/openpcdet/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/ubuntu/anaconda3/envs/openpcdet/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
也就是Qt动态链接库的问题,当加载libqxcb.so库的时候,还需要加载libxcb-xinerama库。
切换到报错libxcb.so所在目录:
cd /home/ubuntu/anaconda3/envs/openpcdet/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms
运行ldd libqxcb.so,查看关联内容:
ldd libqxcb.so
发现不存在libxcb-xinerama.so.0库。
- 解决方案
安装libxcb-xinerama库:
sudo apt-get install libxcb-xinerama0
安装完成后,再次查看关联内容,发现已经修复问题:
ldd libqxcb.so
KeyError: ‘road_plane’
- 问题描述
运行python train.py --cfg_file cfgs/kitti_models/pointpillar.yaml
命令进行训练时。
报错如下:
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'
- 寻找原因
没有road_plane
这个文件夹的数据。 - 解决方案
把USE_ROAD_PLANE
的值改成False
。