创建环境
conda create -n SASSD python=3.7
进入环境
conda activate SASSD
先配置清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
安装pytorch
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=10.2
安装相关环境依赖包
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install shapely -i https://pypi.tuna.tsinghua.edu.cn/simple
安装mayavi,要注意先安装其他依赖包!!!
pip install vtk==8.1.2
pip install pyside2 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install mayavi -i https://pypi.tuna.tsinghua.edu.cn/simple
安装cmake
安装spconv1.2.1
从github上下载1.2.1版本
GitHub - traveller59/spconv: Spatial Sparse Convolution Library
或者用 命令下载,注意查看是否是1.2.1版本,不是的话可以手动下载
git clone https://github.com/traveller59/spconv.git --recursive
下载完成后,从终端进入spconv执行命令
python setup.py bdist_wheel
cd ./dist && pip install *
mmdet/ops中,编译 C++/CUDA模块
cd mmdet/ops/points_op
python setup.py build_ext --inplace
cd mmdet/ops/iou3d
python setup.py build_ext --inplace
cd mmdet/ops/pointnet2
python setup.py build_ext --inplace
因为我们使用的环境版本比作者的高,可能会出现报错
setup.py build_ext fail RuntimeError: Error compiling objects for extension
需要修改文件配置
SA-SSD/mmdet/ops/points_op/src/points_op.cpp
#define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ")
to
#define CHECK_CONTIGUOUS(x) AT_ASSERT(x.is_contiguous())
SA-SSD/mmdet/ops/pointnet2/src/interpolate.cpp
cudaStream_t stream = THCState_getCurrentStream(state);
to
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
SA-SSD/mmdet/ops/iou3d/src/iou3d.cpp
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
#define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ")
to
#define CHECK_CUDA(x) AT_ASSERT(x.type().is_cuda())
#define CHECK_CONTIGUOUS(x) AT_ASSERT(x.is_contiguous())
to前面是源码,后面是修改后的代码!
未完待续.....