mmdetection安装mmcv-full一直在build

本文档详细记录了在CUDA 10.1和PyTorch 1.7.1环境下安装mmcv-full遇到的问题及解决方案。通过修改官方命令中的torch版本为1.7.0,成功安装mmcv-full,并随后克隆并配置mmdetection。最后,提供了验证安装是否正确的代码示例,包括加载预训练模型进行推断。
摘要由CSDN通过智能技术生成

安装mmcv-full

首先查看torch和cuda版本

 官方给的命令如下:

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

我的torch_version是1.7.1, cu_version是cu101,应当使用如下命令:

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

但mmdetection安装mmcv-full一直在build,安装很多次都不行,故使用下面的链接,也就是将torch1.7.1换成torch1.7.0,最终很快就build通过。

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

 安装mmcv-full之后clone mmdetection

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

从gitee的镜像上clone,会快很多

 git clone git@gitee.com:mirrors/mmdetection.git
 pip install -r requirements/build.txt
 pip install -v -e .  # or "python setup.py develop"


Verification

用下面的代码进行验证即可

 from mmdet.apis import init_detector, inference_detector
 ​
 config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
 # download the checkpoint from model zoo and put it in `checkpoints/`
 # url: http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
 checkpoint_file = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
 device = 'cuda:0'
 # init a detector
 model = init_detector(config_file, checkpoint_file, device=device)
 # inference the demo image
 inference_detector(model, 'demo/demo.jpg')
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值