openpcdet项目代码(调试及问答记录)

Q1:

ModuleNotFoundError: No module named ‘pcdet’

A1:

原因:没有编译安装pcdet。
解决:进入openpcdet项目根目录,修改setup.py权限,并编译:

sudo chmod +777 setup.py
python setup.py develop

Q2:

运行demo.py时,报错如下:

ImportError: Could not import backend for traitsui.  Make sure you
        have a suitable UI toolkit like PyQt/PySide or wxPython
        installed.

A2:

原因:没有安装合适的工具
方法1(未成功):根据报错提示,尝试安装pyqt,pyside,安装常规方式直接安装,均失败:

#pip install pyqt # 卡住,失败
#pip install PySide # 卡住,失败

解决2:添加镜像源进行安装,成功解决,代码如下:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyside2

Q3:

demo.py,

Traceback (most recent call last):
  File "demo.py", line 11, in 
    from pcdet.models import build_network, load_data_to_gpu
  File "/data1/users_dir/zhicheng/github/openpcdet/openpcdet/pcdet/models/__init__.py", line 6, in 
    from .detectors import build_detector
  File "/data1/users_dir/zhicheng/github/openpcdet/openpcdet/pcdet/models/detectors/__init__.py", line 1, in 
    from .detector3d_template import Detector3DTemplate
  File "/data1/users_dir/zhicheng/github/openpcdet/openpcdet/pcdet/models/detectors/detector3d_template.py", line 7, in 
    from .. import backbones_2d, backbones_3d, dense_heads, roi_heads
  File "/data1/users_dir/zhicheng/github/openpcdet/openpcdet/pcdet/models/backbones_3d/__init__.py", line 3, in 
    from .spconv_unet import UNetV2
  File "/data1/users_dir/zhicheng/github/openpcdet/openpcdet/pcdet/models/backbones_3d/spconv_unet.py", line 11, in 
    class SparseBasicBlock(spconv.SparseModule):
AttributeError: module 'spconv' has no attribute 'SparseModule'

A3:

方法:参考spconv项目issue

from spconv.pytorch import ops
from spconv.pytorch.conv import (SparseConv2d, SparseConv3d, SparseConvTranspose2d,
                         SparseConvTranspose3d, SparseInverseConv2d,
                         SparseInverseConv3d, SubMConv2d, SubMConv3d)
from spconv.pytorch.core import SparseConvTensor
from spconv.pytorch.identity import Identity
from spconv.pytorch.modules import SparseModule, SparseSequential
from spconv.pytorch.ops import ConvAlgo
from spconv.pytorch.pool import SparseMaxPool2d, SparseMaxPool3d
from spconv.pytorch.tables import AddTable, ConcatTable

版本更新,部分包所属模块变更,根据上边的路径更新包的导入方式(路径)
即,根据报错内容及文件路径,找到报错位置,比如旧版本在使用SparseModule时,方式如下:

import spconv
a = spconv.SparseModule()

新版本要讲上边的代码修改为:

import spconv
a = spconv.pytorch.modules.SparseModule()

鉴于代码的简洁美观,一般使用下列方式:

from spconv.pytorhc.modules import SparseModule
a = SpacsreModule()

Q4:

运行:python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml生成训练所需的数据info文件时,报错如下:

TypeError: load() missing 1 required positional argument: 'Loader'

A4:

解决:yaml.load()改为yaml.safe_load()
openpcdet项目代码(调试及问答记录)_第1张图片

Q5:训练日志可视化脚本

A5:

训练完成后,在output文件夹内为训练的日志即模型参数,output内文件示例如下图,其中tensorboard文件夹就是为tensorboard可视化而生成的文件夹:
openpcdet项目代码(调试及问答记录)_第2张图片

运行命令,

cd output/kitti_models
tensorboard --logdir tensorboard/

运行之后会返回一个链接,如下图中的链接http://localhost:6007/,右击链接复制打开:
openpcdet项目代码(调试及问答记录)_第3张图片

效果如下:
openpcdet项目代码(调试及问答记录)_第4张图片

你可能感兴趣的:(OpenPCDet,记录,自动驾驶,点云目标检测)