ubuntu18.04下使用conda配置mmdetection

终于配置好,凭记忆记录一下过程,防止以后重装系统忘记……

这里默认之前已经配置好nvidia驱动和anaconda环境

1、打开terminal,创建环境

# 不使用最新版本python
conda create -n mmdetection python=3.7
conda activate mmdetection

2、安装pytorch

在官网PyTorch点击previous version of pytorch

执行

# CUDA 10.1
pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html

3、mmcv-full

官方给的安装命令

pip install mmcv-full==latest+torch1.5.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html

4、mmdetection

https://github.com/open-mmlab/mmdetection

下载mmdetection-master文件,解压缩extract here

cd mmdetection-master
pip install -r requirements.txt
python setup.py install

p.s.:这里安装到最后检测图片时可能会报错说mmdet版本需要mmcv>=多少而我们安装版本过低的问题,这时候只要升级一下mmcv版本就好

如果不是安装这个版本可参看官方项目,选择自己所需要的版本https://github.com/open-mmlab/mmcv#install-with-pip

比如说这里需要mmcv>=1.3.8

pip install mmcv-full==1.3.8 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.5.0/index.html

5、cocoapi

在https://github.com/cocodataset/cocoapi下载,解压之后进入pythonAPI文件夹,在pythonAPI下打开terminal

pip install -v -e .

6、检查是否成功

conda list

检查是否有mmdet、mmcv-full、pytorch、pycocotools等

7、运行demo

首先在mmdetection-master文件夹下建立文件夹checkpoints,在https://github.com/open-mmlab/mmdetection/tree/master/configs/faster_rcnn中下载model,放入checkpoints文件夹中

R-50-FPN pytorch 1x 4.0 21.4 37.4

model | log

 运行

python demo/image_demo.py demo/demo.jpg configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth 

得到

成功啦!

你可能感兴趣的:(pytorch,深度学习,神经网络)