3D目标检测算法配置--CIA-SSD与spconv1.2的安装

3D目标检测算法配置–CIA-SSD与spconv1.2的安装

MiniConda

要是安装过anaconda的话就可以跳过这一步,注意不要将conda加到环境变量里面,要不然可能会有意想不到的报错,很麻烦

wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh# 记住更新PATH到~/.bashrc时选no

没有加入环境变量时启动conda可以用该命令

source <path_to_your_conda_installation>/bin/activate# 默认进入base
source <path_to_your_conda_installation>/bin/activate <your_env_name># 进入指定环境

spconv1.2的安装

CIA-SSD的安装中就是这个spconv安装最麻烦,CIA-SSD的作者写的是需要spconv1.0版本就可以,但是实际跑代码的时候1.0版本缺少了一个函数,只能换成1.2版本(麻了,彻底麻了)

conda create --name CIA-SSD python=3.8 pytorch=1.4 torchvision=0.5 cudatoolkit=10.1 cudatoolkit-dev=10.1 cmake --channel pytorch

conda activate CIA-SSD

conda install cudnn

conda install boost

git clone https://github.com/traveller59/spconv.git --recursive#要是加载超时可以把第一个https换成git

使用which nvcc#查看cuda路径

在CMakeList.txt中添加以下cuda路径,添加在第五行,添加完如下图所示。(或者在setup.py的cmake_args中添加’-DCMAKE_CUDA_COMPILER=/home/detection/local/miniconda3/envs/CIA-SSD/bin/nvcc’)
在这里插入图片描述

接下来将~/miniconda3/envs/CIA-SSD/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Targets.cmake这个文件中usr相关的依赖项全部改成自己路径下的,然后重新运行应该就可以了。

在spconv文件夹下进行编译运行

python setup.py bdist_wheel

cd dist/

pip install *

如果报错error: ‘RegisterOperators’ is not a member of ‘torch’,将对应文件所在行的中的torch::RegisterOperators改为torch::jit::RegisterOperators即可。

代码位置spconv/src/spconv/all.cc,line20

/* 这个是原版 */
static auto registry =
    torch::jit::RegisterOperators("spconv::get_indice_pairs_2d", &spconv::getIndicePair<2>)
        .op("spconv::get_indice_pairs_3d", &spconv::getIndicePair<3>)
/* 由于torch版本更新命名空间,需要把jit删掉,如下 */
static auto registry =
    torch::RegisterOperators("spconv::get_indice_pairs_2d", &spconv::getIndicePair<2>)
        .op("spconv::get_indice_pairs_3d", &spconv::getIndicePair<3>)

Det3D的安装

在安装Det3D过程中可能出现一片红的报错,不要慌,先等他运行完,看看能不能用,不能用再找问题解决

git clone https://github.com/poodarchu/Det3D.git#要是连接超时可以参考上面

cd Det3D

python setup.py build develop

CIA-SSD的安装

安装CIA-SSD的时候缺少fire库,yaml库,requests库。可以选择在安装CIA-SSD前安装这些库,也可以先运行代码,出现报错之后再解决

pip install fire#安装fire库

pip install pyyaml#安装fire库,注意包名是pyyaml不是yaml

pip install requests#安装requests库

python ./CIA-SSD/tools/create_data.py#安装CIA-SSD

要是出现ModuleNotFoundError: No module named ‘det3d.ops.nms.nms’ 解决方法就是再次进入Det3D重新编译

cd  Det3D

python setup.py build develop

在这里插入图片描述

这种情况,根据报错的路径(比如错误路径为/home/detection/CIA-SSD/tools/create_data.py line11)进入查看可发现报错为路径错误

原代码为

在这里插入图片描述

将代码中的相对路径改成绝对路径,比如如下图

在这里插入图片描述

然后重新运行

python ./CIA-SSD/tools/create_data.py

目前就到了这些报错,要是以后安装出现新的报错要是以后出现新的报错还会再来更新,第一次搭建虚拟环境,有什么错误的地方欢迎大家纠错指正

版权声明:本文为CSDN博主「急雨」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_50444970/article/details/117191289

急雨

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

目标检测-锚框概念和代码实现

前言 经历过图像分类后,进一步的就是更复杂的目标检测了,从这一章开始,将会不断记录图像目标检测中的学习经历,其中大多数思路以及代码来源,来自于李沐的动手学深度学习课程&#x

YOLO-V3-SPP详细解析

YOLO-V3-SPP 继前两篇简单的YOLO博文 YOLO-V1 论文理解《You Only Look Once: Unified, Real-Time Object Detection》YOLO-V2论文理解《YOLO9000: Bet