【环境配置/软件安装】win10配置mmdetection

1、下载MMDetection

地址下载链接 可以在branch中选择对应的下载版本,也可以直接下载lastest的版本。建议使用新的版本。

MMDetection VS mmcv记下你下的MMDetection对应的mmcv版本后面要用到

2、配置pytorch+torchvision

地址下载链接 根据自己的cuda版本选择torch版本。

3、安装mmcv

打开 mmcv github官网 可以看到下面这个表格根据自己的torch版本和cuda版本(或者cpu) 点击对应的三角形图标(没有图标的说明当前版本没有可用的mmcv)
在这里插入图片描述
可以看到对应的 下载命令如:

pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html

再根据1中的mmcv-full版本修改上面的命令。这一步会有点慢,不是卡了,不要动它,过会就好了。

如果配置出现错误:
在这里插入图片描述
就是你的电脑没有安装c++编译环境 需要下载 地址: Visual Studio 默认安装即可

4、安装pycocotools

windows指令:

pip install pycocotools-windows

linux/ubuntu指令:

pip install pycocotools

5、安装requirements.txt

pip install -r requirements.txt

6、编译mmdet

python setup.py develop

如果报错:客户端没有所需的特权之类的权限问题,就直接管理员方式打开pycharm 再运行下这行代码在这里插入图片描述
pip list出现mmcv和mmdet的时候,基本上就配置成功了。

6、测试

下面测试下代码:

先下载所需权重.

新建test.py

from mmdet.apis import init_detector, inference_detector
import mmcv

# Specify the path to model config and checkpoint file
config_file = './configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
checkpoint_file = './checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'

# build the model from a config file and a checkpoint file
model = init_detector(config_file, checkpoint_file, device='cpu')

# test a single image and show the results
img = './demo/demo.jpg'  # or img = mmcv.imread(img), which will only load it once
result = inference_detector(model, img)
# visualize the results in a new window
model.show_result(img, result)
# or save the visualization results to image files
model.show_result(img, result, out_file='result.jpg')

执行结果:
在这里插入图片描述
到这里就安装完毕了。

至于ubuntu和wins就更简单了,步骤和上面类似,但是会少很多的bug,大家可以自己回去试试。

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值