1.首先新建conda虚拟环境,安装pytorch

mmdetection不推荐1.11.0版本的torch

pytorch官方中torch历史版本:https://pytorch.org/get-started/previous-versions/

conda create -n mmdet python=3.7

查看conda环境

conda info --env

在这里插入图片描述
安装pytorch

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

2.安装mmcv-full

mmdetection中文文档:
https://mmdetection.readthedocs.io/zh_CN

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

这里的cu_version和torch_version是根据自己版本而定的,不清楚的可以看下面这个网址:
https://gitee.com/cubone/mmcv
根据上面安装的pytorch版本,我的mmcv-full安装指令如下:

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

3.下载、编译、安装mmdetection

首先,安装git

conda install git

安装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"

若服务器不能翻墙,就从本机上下载后传到服务器即可

4.测试

python tools/train.py -h

在这里插入图片描述

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐