mmdetection安装与环境配置


最近自己真的安装了太多的计算机视觉环境了(越来越会找bug了,是不是很棒,hh),这次趁热打铁总结一下mmdetection的安装步骤。

一、确定所需安装的版本

涉及到 cuda,python,pytorch,mmcv,gcc:

在这里插入图片描述这里我用的是CUDA=10.2 Python=3.7 pytorch=1.5.0

二、创建虚拟环境

conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

三、安装pytorch

官网上找到对应cuda和python的版本:

在这里插入图片描述我这里是

conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch

四、安装mmcv

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

注意:这样安装,是安装相应cuda和pyroch版本下最新版的mmcv,{cu_version} 和{torch_version}要对应自己的版本,我的就是:

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

也可以指定mmcv版本,不过需要注意之后打算使用的MMDetection版本:
在这里插入图片描述

此外mmcv-full的版本也是受限于cuda和pytorch的版本,我这里mmcv最高就1.2.7,不过已经妥妥够用了:

在这里插入图片描述

五、下载并安装MMDetection代码和相关包

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

如果失败了,就去网站上下载吧。

之后安装相关包:

pip install -r requirements

六、测试是否安装成功

1)创建文件夹checkpoints,并把下载的预训练模型放在其中,下载地址http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth.
2)运行demo代码:

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

如下图则成功:
在这里插入图片描述

github官方.
MMDtection使用说明.

猜你喜欢

转载自blog.csdn.net/qq_41917697/article/details/114899523
今日推荐