【环境配置】:mmdetection安装

https://mmdetection.readthedocs.io/zh_CN/latest/

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

1、创建虚拟环境

在这里插入图片描述

2、激活虚拟环境

conda activate open-mmlab

在这里插入图片描述

3、安装cython

在这里插入图片描述

4、基于Pytorch官网安装 PyTorch 和 torchvision

【环境配置】:mmdetection安装_第1张图片

5、根据cuda与torch版本安装mmcv

【环境配置】:mmdetection安装_第2张图片

6、安装mmdet

【环境配置】:mmdetection安装_第3张图片

7、各包版本

【环境配置】:mmdetection安装_第4张图片

8、测试

在demo文件夹下新建test.py文件

【环境配置】:mmdetection安装_第5张图片

from mmdet.apis import init_detector, inference_detector

config_file = '../configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# 从 model zoo 下载 checkpoint 并放在 `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
checkpoint_file = '../checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
device = 'cuda:0'
# 初始化检测器
model = init_detector(config_file, checkpoint_file, device=device)
# 推理演示图像
inference_detector(model, 'demo.jpg')

出现报错

【环境配置】:mmdetection安装_第6张图片

打开configs/base/models

打开faster_rcnn_r50_fpn.py

【环境配置】:mmdetection安装_第7张图片
【环境配置】:mmdetection安装_第8张图片

如上修改后运行成功

你可能感兴趣的:(深度学习,深度学习,目标检测)