采用矩池云配置MMDetection环境

终于配置好了在这里插入图片描述

租用环境

镜像:
Pytorch 1.5.0
镜像描述:
预装:Python3.8, CUDA 10.1, cuDNN 7.6, Pytorch 1.5.0, Ubuntu 18.04

安装

安装torch

conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch -y

安装mmcv-full

提前在/mnt文件夹下创建文件夹MMDetection,然后进入该文件夹,安装mmcv-full

cd /mnt/MMDetection
pip install mmcv-full==1.3.8 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

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

或者 直接使用pip安装 再使用里面的代码

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

环境测试

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)
# 推理演示图像
img = 'demo/demo.jpg'
result = inference_detector(model, 'demo/demo.jpg')
model.show_result(img, result)
model.show_result(img, result, out_file='result1111.jpg') # 保存推理图像

测试结果

在这里插入图片描述

版权声明:本文为CSDN博主「开始学AI」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_41964545/article/details/121676419

开始学AI

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

目标检测中ROC的实现【1】

评价目标检测中的各种标准,如map,ROC通常用于分类算法中,按照混淆矩阵的计算方式: ROC计算方式 ROC 为FPR(假阳率)为横坐标,TPR&#xff0

Anchor Free系列模型13

2021SCSDUSC CenterNet训练自己的数据集(接上文) 注意这里json文件的命名要通过datasets/pascal.py中第44到48行的内容确定的。 self.data_dir os.path