TransFusion简介、环境配置与安装以及遇到的各种报错处理

TranFusion简介

针对以下两个问题:

  1. 通过串联或相加融合Lidar和Camera,在图像质量变差时感知性能会下降;
  2. 稀疏的点云和稠密的图像之间寻找“硬关联”会使图像的语义信息有所损失,而且传感器之间固有的时空特性而难以高质量地校准。

Transfusion提出了一种lidar和camera“软关联”的融合方法,利用点云特征和图像特征初始化object query(可以加速模型训练和收敛),object query首先与lidar特征交互,再与2D图像特征进行交互更新object query,最后通过FFN得到检测结果。Transfusion的网络结构如下图所示:
在这里插入图片描述

TransFusion环境配置与安装

基本环境如下:

  • Linux(Ubuntu 18.04)
  • NVIDIA GeForce RTX 2080Ti
  • NVIDIA显卡驱动版本:11.4
  • CUDA version:10.2
  • gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

TransFusion环境配置与安装:

#创建conda环境
conda create -n transfusion python=3.7 -y
conda activate transfusion
# 安装pytorch
pip install torch==1.10.0+cu102 torchvision==0.11.0+cu102 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
# 安装mmcv
pip install mmcv-full==1.3.11 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html
# 安装mmdetection
pip install mmdet==2.11.0
# 下载TransFusion的Github库
git clone https://github.com/XuyangBai/TransFusion.git
cd TransFusion
# 编译、安装mmdetection3d
pip install -v -e .

报错

报错一

error: subprocess-exited-with-error
× Running setup.py install for mmpycocotools did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running install
/opt/conda/envs/pycoco/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/init.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-37/pycocotools
running build_ext
building ‘pycocotools._mask’ extension
creating build/temp.linux-x86_64-cpython-37
creating build/temp.linux-x86_64-cpython-37/common
creating build/temp.linux-x86_64-cpython-37/pycocotools
gcc -pthread -B /opt/conda/envs/pycoco/compiler_compat -Wl,–sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/envs/pycoco/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/envs/pycoco/include/python3.7m -c …/common/maskApi.c -o build/temp.linux-x86_64-cpython-37/…/common/maskApi.o
gcc: error: …/common/maskApi.c: No such file or directory
error: command ‘/usr/bin/gcc’ failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mmpycocotools

解决办法:
安装指定版本的Cython

pip install Cython==0.29.36

报错二

在运行pip install -v -e .时,遇到如下报错:

/XXX/XXX/TransFusion/mmdet3d/ops/voxel/src/scatter_points_cuda.cu(272): error: no instance of overloaded function “at::Tensor::index_put_” matches the argument list
argument types are: (at::Tensor, at::Tensor)
object type is: at::Tensor
1 error detected in the compilation of “/XXX/XXX/TransFusion/mmdet3d/ops/voxel/src/scatter_points_cuda.cu”.
ninja: build stopped: subcommand failed.

解决方法:
打开scatter_points_cuda.cu:

vim mmdet3d/ops/voxel/src/scatter_points_cuda.cu

修改第272行代码为coors_map.index_put_({coors_id_argsort}, coors_map_sorted);

报错三

博主在准备nuscenes数据时,遇到如下的报错:

AttributeError: module ‘pycocotools’ has no attribute ‘version

首先卸载pycocotools:

pip uninstall pycocotools

然后安装mmpycocotools:

pip install mmpycocotools

然后遇到

“ModuleNotFoundError: No module named ‘pycocotools’ ”

重新安装mmpycocotools:

pip uninstall mmpycocotools
pip install mmpycocotools

报错四

AttributeError: module ‘distutils’ has no attribute ‘version’

解决办法:
安装指定版本的setuptools

pip install setuptools==59.5.0

报错五

在模型训练时遇到此错误:

RuntimeError: /XXX/XXX/TransFusion/mmdet3d/ops/spconv/src/indice_cuda.cu 118
cuda execution failed with error 700
terminate called after throwing an instance of ‘c10::CUDAError’
what(): CUDA error: an illegal memory access was encountered
Exception raised from create_event_internal at …/c10/cuda/CUDACachingAllocator.cpp:1211 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x42 (0x7f2292e25d62 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: + 0x1c4d3 (0x7f22930884d3 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libc10_cuda.so)
frame #2: c10::cuda::CUDACachingAllocator::raw_delete(void*) + 0x1a2 (0x7f2293088ee2 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libc10_cuda.so)
frame #3: c10::TensorImpl::release_resources() + 0xa4 (0x7f2292e0f314 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #4: + 0x299ee9 (0x7f2181b7aee9 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #5: + 0xae8069 (0x7f21823c9069 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #6: THPVariable_subclass_dealloc(_object*) + 0x2b9 (0x7f21823c9389 in /XXX/XXX/miniconda3/envs/transfusion/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #7: python() [0x497017]
frame #8: python() [0x4a0a87]
frame #9: python() [0x4b5cfb]
frame #10: python() [0x4b5cfb]
frame #11: python() [0x4b0858]
frame #12: python() [0x4c5b50]
frame #13: python() [0x4c5b66]
frame #14: python() [0x4c5b66]
frame #15: python() [0x4c5b66]
frame #16: python() [0x4c5b66]
frame #17: python() [0x4c5b66]
frame #18: python() [0x4c5b66]
frame #19: python() [0x4946f7]

frame #23: python() [0x53fc79]
frame #25: __libc_start_main + 0xe7 (0x7f22a7bc9c87 in /lib/x86_64-linux-gnu/libc.so.6)
frame #26: python() [0x53f9ee]

解决方法:
如果是单卡训练,使用–gpu-id 0进行训练,如果使用gpu1/2/3均会报次错误;
如果是多卡训练,gpu-id要从0开始。

附:
在github上有通过把mmdet3d/ops/spconv/src/indice_cuda.cu文件里面所有的4096改为256来解决此报错的,但我没有尝试,如果使用上述方法未解决此问题,可以修改一下试试。

报错六

在模型训练时遇到此错误:

RuntimeError: CUDA error: out of memory

解决方法:
(1)减少batch-size;
(2)如果是单卡训练,观察0号显卡的显存是否已经满了,因为在其他卡(非0号卡)上训练时,需要占用一部分0号卡的显卡;
(3)换用更大显存的显卡(建议至少16G)。

报错七

在模型训练时遇到此错误:

RuntimeError: shape ‘[-1, 4, 16]’ is invalid for input of size 2160

解决方法:
检查pointcloud的维度(N,C),确认C的维度和模型参数想匹配,可以print()一下变量的shape,以便进一步查错。

报错八

File “/XXX/XXX/mmdet3d/ops/spconv/ops.py”, line 92, in get_indice_pairs
return get_indice_pairs_func(
RuntimeError: mmdet3d/ops/spconv/src/indice_cuda.cu 124
cuda execution failed with error 2

我反复Debug没有找到原因,后来,在网上找到的:此报错的原因是显存不够,建议换用更大显存的显卡,成功解决。

  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 15
    评论
根据提供的引用内容,报错信息显示在安装mmdetection3d时出现了问题。具体来说,报错信息包括两个部分。首先,报错一指出在执行`get_indice_pairs`函数时出现了错误,具体错误信息是`cuda execution failed with error 2`。其次,报错二指出在编译`scatter_points_cuda.cu`文件时出现了错误,具体错误信息是`no instance of overloaded function "at::Tensor::index_put_" matches the argument list`。 针对这个问题,可能的原因是环境配置或依赖项安装不正确。为了解决这个问题,可以尝试以下几个步骤: 1. 确保已正确创建并激活了名为`transfusion`的conda环境,并且Python版本为3.7。 2. 确保已正确安装了PyTorch、mmcv和mmdet。可以使用`pip list`命令检查已安装的包,并确保版本与引用中提供的版本一致。 3. 检查CUDA和cuDNN的版本是否与安装的PyTorch版本兼容。可以在PyTorch官方网站上查找相应的兼容性信息。 4. 如果报错一中的错误是由于CUDA执行失败导致的,可以尝试更新显卡驱动程序或降低PyTorch的版本。 5. 如果报错二中的错误是由于编译错误导致的,可以尝试更新或重新安装相关的依赖项,如mmpycocotools。 关于mmpycocotools安装问题,由于提供的引用内容中没有包含相关信息,无法给出具体的解决方案。但一般来说,可以尝试使用以下命令安装mmpycocotools: ``` pip install mmpycocotools ``` 如果仍然遇到问题,建议查阅相关文档或寻求开发者或社区的帮助来解决安装问题。 #### 引用[.reference_title] - *1* *2* *3* [TransFusion环境配置以及遇到的各种报错处理](https://blog.csdn.net/weixin_43603658/article/details/131756871)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI Player

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值