当前位置:   article > 正文

NVIDIA Jetson AGX Orin配置OpenPCDet环境部署PointRCNN_jetson cumm

jetson cumm

环境:Ubuntu20.04+jetpack5.0.2+python3.8
CUDA11.4+cuDNN8.4.1.50
torch1.13
参考:NVIDIA Jetson AGX Orin配置OpenPCDet环境部署PointPillar

安装spconv和cumm库

参考:NVIDIA Jetson AGX Xavier安装OpenPCDet完整踩坑记录_Popuffu的博客-CSDN博客
github下载对应版本后使用setup.py编译轮子,再用pip安装轮子,注意声明环境参数,在安装前运行

export CUMM_CUDA_VERSION="11.4" # 11.4为cuda版本
export CUMM_DISABLE_JIT="1" # 不用JIT编译cumm,而是编译成whl后再安装
export CUMM_CUDA_ARCH_LIST="8.7" # xavier是7.2,TX2是6.2,orin是8.7
  • 1
  • 2
  • 3

我选择的是cumm-cu114 0.4.11和spconv-cu114 2.3.6
GitHub - FindDefinition/cumm: CUda Matrix Multiply library
GitHub - traveller59/spconv: Spatial Sparse Convolution Library

安装llvm,llvmlite

同样参考:NVIDIA Jetson AGX Xavier安装OpenPCDet完整踩坑记录_Popuffu的博客-CSDN博客
llvm从对应的github仓库的release里面下载aarch64的对应版本的预编译好的文件,解压以后添加环境变量。开始我选的是LLVM 17.0.5,安装报错后我选择安装LLVM 17.0.4,安装成功
Releases · llvm/llvm-project · GitHub
接下来安装llvmlite:

pip install llvmlite
  • 1

二者版本对应关系:llvmlite · PyPI

安装OpenPCDet

下载OpenPCDet v0.6.0

git clone https://github.com/open-mmlab/OpenPCDet.git
unzip OpenPCDet-master.zip
mv OpenPCDet-master OpenPCDet
cd OpenPCDet
pip install -r requirements.txt
python3 setup.py develop或者把报错都解决后python3 setup.py install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

1. warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]

将所有代码中Tensor.data<…>()替换为Tensor.data_ptr<…>()
(总共替换142处,都是pcdet/ops/中的文件,反正全部替换过来即可)

2. warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]

将所有代码中x.type()的".type()"删去即可,即代码中的x.type().is_cuda()替换为x.is_cuda()
(总共11处,都是pcdet/ops/中的文件)

3. error: subprocess.CalledProcessError: Command ‘[‘ninja‘, ‘-v‘]‘ returned non-zero exit status 1”

将setup.py中的“cmdclass={‘build_ext’: BuildExtension}”这一行改为“cmdclass={‘build_ext’: BuildExtension.with_options(use_ninja=False)}”,pytorch默认使用ninjia作为backend,这里把它禁用掉就好了;
网上有一些方法让将torch/utils/cpp_extension.py中的[‘ninja’,‘-v’]改成[‘ninja’,‘–version’],这个方法或许可行,但修改系统文件是很危险的,不建议这么做。

运行demo.py

Quick Demo

  1. 下载预训练好的pointrcnn模型:PointRCNN-model-16M
OpenPCDet
├── checkpoints
│   ├── pointrcnn_7870.pth
├── data
├── pcdet
├── tools
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 安装open3d(mayavi安装很麻烦)
  2. KITTI按照下面的结构存放。因为我的KITTI数据存放在别的文件夹,所以我使用了两个软链接指过去。使用的是KITTI数据所以不用预处理
OpenPCDet
├── data
│   ├── kitti
│   │   │── ImageSets
│   │   │── training
│   │   │   ├──calib & velodyne & label_2 & image_2 & (optional: planes) & (optional: depth_2)
│   │   │── testing
│   │   │   ├──calib & velodyne & image_2
├── pcdet
├── tools
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
cd data/kitti
ln -s ~/volume/PointRCNN/data/KITTI/object/training/ training
ln -s ~/volume/PointRCNN/data/KITTI/object/testing/ testing
  • 1
  • 2
  • 3
  1. Generate the data infos by running the following command:
cd OpenPCDet
python3 -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml
  • 1
  • 2
  1. Run the demo with a pretrained model:
python3 demo.py --cfg_file cfgs/kitti_models/pointrcnn.yaml --ckpt ../checkpoints/pointrcnn_7870.pth --data_path ../data/kitti/training/velodyne/000008.bin
  • 1

ModuleNotFoundError: No module named ‘pcdet’
在demo.py中加入

import sys
sys.path.append(PATH)  #OpenPCDet/所在路径
  • 1
  • 2

由于在命令行没有可视化界面,所以貌似运行不了。。。

2023-11-20 12:54:40,716   INFO  Visualized sample index:        1
[Open3D WARNING] GLFW Error: X11: The DISPLAY environment variable is missing
[Open3D WARNING] Failed to initialize GLFW
Traceback (most recent call last):
  File "demo.py", line 113, in <module>
    main()
  File "demo.py", line 101, in main
    V.draw_scenes(
  File "/root/volume/OpenPCDet/tools/visual_utils/open3d_vis_utils.py", line 49, in draw_scenes
    vis.get_render_option().point_size = 1.0
AttributeError: 'NoneType' object has no attribute 'point_size'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

运行test.py

GETTING_STARTED

python3 test.py --cfg_file cfgs/kitti_models/pointrcnn.yaml --batch_size 16 --ckpt ../checkpoints/pointrcnn_7870.pth --infer_time
  • 1
2023-11-20 13:13:46,784   INFO  Car AP@0.70, 0.70, 0.70:
bbox AP:90.7820, 89.6547, 89.2056
bev  AP:90.0484, 87.3777, 86.5750
3d   AP:88.6188, 78.5465, 77.6281
aos  AP:90.77, 89.56, 89.04
Car AP_R40@0.70, 0.70, 0.70:
bbox AP:96.4662, 92.9027, 90.5241
bev  AP:93.2005, 89.0023, 86.8322
3d   AP:91.0759, 80.4579, 77.9758
aos  AP:96.45, 92.80, 90.36
Car AP@0.70, 0.50, 0.50:
bbox AP:90.7820, 89.6547, 89.2056
bev  AP:90.7446, 89.7929, 89.5078
3d   AP:90.7446, 89.7603, 89.4514
aos  AP:90.77, 89.56, 89.04
Car AP_R40@0.70, 0.50, 0.50:
bbox AP:96.4662, 92.9027, 90.5241
bev  AP:96.4749, 95.0989, 92.8830
3d   AP:96.4751, 94.9145, 92.7614
aos  AP:96.45, 92.80, 90.36
Pedestrian AP@0.50, 0.50, 0.50:
bbox AP:73.5095, 65.7689, 62.2409
bev  AP:63.4347, 58.9105, 52.5143
3d   AP:61.3689, 53.8344, 49.9219
aos  AP:71.22, 62.94, 59.31
Pedestrian AP_R40@0.50, 0.50, 0.50:
bbox AP:74.4947, 67.7302, 61.0813
bev  AP:64.8432, 57.5454, 50.9380
3d   AP:61.2496, 54.0018, 47.3366
aos  AP:71.96, 64.48, 57.96
Pedestrian AP@0.50, 0.25, 0.25:
bbox AP:73.5095, 65.7689, 62.2409
bev  AP:81.8234, 74.9909, 67.2878
3d   AP:81.7957, 74.9260, 67.1490
aos  AP:71.22, 62.94, 59.31
Pedestrian AP_R40@0.50, 0.25, 0.25:
bbox AP:74.4947, 67.7302, 61.0813
bev  AP:82.9904, 76.4039, 69.1696
3d   AP:82.9573, 76.2548, 68.9429
aos  AP:71.96, 64.48, 57.96
Cyclist AP@0.50, 0.50, 0.50:
bbox AP:95.6644, 77.2475, 75.1094
bev  AP:86.7136, 72.5822, 66.7247
3d   AP:85.6353, 66.7699, 64.9785
aos  AP:95.28, 76.71, 74.54
Cyclist AP_R40@0.50, 0.50, 0.50:
bbox AP:96.8042, 77.6159, 74.4501
bev  AP:91.8013, 72.1001, 68.8331
3d   AP:90.3282, 68.6796, 65.4311
aos  AP:96.38, 77.03, 73.85
Cyclist AP@0.50, 0.25, 0.25:
bbox AP:95.6644, 77.2475, 75.1094
bev  AP:94.4500, 75.1637, 72.8663
3d   AP:94.4500, 75.1637, 72.8663
aos  AP:95.28, 76.71, 74.54
Cyclist AP_R40@0.50, 0.25, 0.25:
bbox AP:96.8042, 77.6159, 74.4501
bev  AP:95.6110, 75.4792, 72.1654
3d   AP:95.6110, 75.4792, 72.1654
aos  AP:96.38, 77.03, 73.85
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
/usr/local/lib/python3.8/dist-packages/numba/core/typed_passes.py:334: NumbaPerformanceWarning:
The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.

To find out why, try turning on parallel diagnostics, see https://numba.readthedocs.io/en/stable/user/parallel.html#diagnostics for help.

File "../pcdet/datasets/kitti/kitti_object_eval_python/eval.py", line 122:
@numba.jit(nopython=True, parallel=True)
def d3_box_overlap_kernel(boxes, qboxes, rinc, criterion=-1):
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

把parallel=True改为parallel=False

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/434364
推荐阅读
相关标签
  

闽ICP备14008679号