mmdetection环境搭建(linux)

新建环境

conda create -n mmdetection python=3.7

激活环境

conda activate mmdetection

 安装pytorch(在官网pytorch.org上找到对应版本)

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.2 -c pytorch

安装mccv-full

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

其中cu_version和torch_version根据自己的版本选择,比如我的是cuda10.2对应的pytorch1.7.1,使用如下命令进行安装

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

在别的服务器上配环境的时候按照上述步骤报错 Could not build wheels for mmcv-full

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mmcv-full
  Running setup.py clean for mmcv-full
Failed to build mmcv-full
ERROR: Could not build wheels for mmcv-full, which is required to install pyproject.toml-based projects

 通过下述命令成功安装

pip install -U openmim
mim install mmcv-full

 

github上下载项目 (master版本)open-mmlab/mmdetection: OpenMMLab Detection Toolbox and Benchmark (github.com)

build

cd mmdetection
pip install -r requirements/build.txt
pip install -v -e .

项目文件夹下新建文件夹checkpoints,下载权重文件放到checkpoints里面,测试demo

权重文件下载链接 http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth

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

得到检测结果

可能会有这个报错

TypeError: FormatCode() got an unexpected keyword argument ‘verify‘

解决方法见mmdetection 报错 TypeError: FormatCode() got an unexpected keyword argument ‘verify‘-CSDN博客 

可参考文档:

mmdetection github open-mmlab/mmdetection: OpenMMLab Detection Toolbox and Benchmark (github.com)

中文文档:开始你的第一步 — MMDetection 3.2.0 文档 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值