安装MMdetection3D和MinkowskiEngine

MMdetection3D更新了,只好再次安装,由于CUDA,cuDNN,PyTorch以前已经安装了,这次就不需要安装了,只需要安装MMdetection3D就行了.

1. 安装MMCV

输入以下命令:

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

如我的CUDA版本是11.2,PyTorch是1.11.0:

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu112/torch1.11.0/index.html

2. 安装MMDetection

依次输入以下命令:

git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/build.txt
pip install -v -e .  # or "python setup.py develop"

如果github.com速度慢,也可以换成gitee.com.

3. 安装MMDetection3D

依次输入以下命令:

git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
pip install -v -e .

同样的,如果github.com速度慢,也可以换成gitee.com.

4. 安装MinkowskiEngine

由于最新版的MMDetection3D用到了MinkowskiEngine,还需要安装MinkowskiEngine.

首先下载(这个gitee.com好像没有):

git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd MinkowskiEngine

将setup.py第142行

MAX_COMPILATION_THREADS = 12

改成

MAX_COMPILATION_THREADS = 4

然后更换gcc/g++的版本,依次输入以下命令:

sudo apt install gcc-7
sudo apt install g++-7

rm /usr/bin/gcc  
ln -s /usr/bin/gcc-7 /usr/bin/gcc  
rm /usr/bin/g++  
ln -s /usr/bin/g++-7 /usr/bin/g++  

gcc --version
g++ --version

如果gcc/g++的版本都是7.5.0就可以了.

再安装安装MinkowskiEngine:

python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas

其中${CONDA_PREFIX}是Conda环境名称,如我的Conda环境是hzmd:

python setup.py install --blas_include_dirs=hzmd/include --blas=openblas

这里又出现了一个错误:

fatal error: cblas.h: No such file or directory

输入:

sudo apt-get install libopenblas-dev

错误解决,再次输入MinkowskiEngine安装命令,耐心等待了一段时间,安装成功,MMDetection3D也可以运行了! 

posted @ 2022-08-14 15:27  MSTK  阅读(1129)  评论(0编辑  收藏  举报