第一步:
使用anaconda创建一个虚拟环境使其与系统主环境相隔离
conda create -n open-mmlab python=3.7 -y
source activate open-mmlab#激活刚才创建的open-mmlab虚拟环境
第二步:
在open-mmlab虚拟环境中安装pytorch
2.1 安装之前需要将清华的pytorch源加入到anaconda中
在终端输入下面一句然后回车
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
2.2 紧接着:
conda install pytorch=1.1.0 torchvision cudatoolkit=10.0#切记把 -c pytorch给删除
第三步:
安装依赖项和把mmdetection进行安装
3.1 将路径cd到你的mmdetection路径下面
git clone https://github.com/open-mmlab/mmdetection.git#git下载很慢的可以去官网下载
cd mmdetection
3.2 安装cython和依赖包
pip install cython
pip install -r requirements.txt
3.3 安装mmdetection
python setup.py develop
安装过程如下
(open-mmlab) bubble@XPS-8930:~/mmdetection/0827/mmdetection$ python setup.py develop
Compiling mmdet/ops/nms/src/soft_nms_cpu.pyx because it changed.
[1/1] Cythonizing mmdet/ops/nms/src/soft_nms_cpu.pyx
/home/bubble/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/setuptools/dist.py:474: UserWarning: Normalizing '1.0.rc0+bfce31c' to '1.0rc0+bfce31c'normalized_version,
running develop
running egg_info
...
...
Using /home/bubble/anaconda3/envs/open-mmlab/lib/python3.7/site-packages
Searching for setuptools==41.2.0
Best match: setuptools 41.2.0
Adding setuptools 41.2.0 to easy-install.pth file
Installing easy_install script to /home/bubble/anaconda3/envs/open-mmlab/binUsing /home/bubble/anaconda3/envs/open-mmlab/lib/python3.7/site-packages
Searching for decorator==4.4.0
Best match: decorator 4.4.0
Adding decorator 4.4.0 to easy-install.pth fileUsing /home/bubble/anaconda3/envs/open-mmlab/lib/python3.7/site-packages
Finished processing dependencies for mmdet==1.0rc0+bfce31c
安装成功了
官网安装教程:https://github.com/open-mmlab/mmdetection/blob/master/docs/INSTALL.md