栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

深度学习系列之mmdetection目标检测工具安装、测试

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

深度学习系列之mmdetection目标检测工具安装、测试

深度学习系列之mmdetection目标检测工具安装、测试

  Windows10 环境下mmdetection安装

文章目录
  • 深度学习系列之mmdetection目标检测工具安装、测试
  • 前言
  • 一、安装前准备
  • 二、安装
    • 1.Pytorch安装
    • 2.安装mmcv-full(根据CUDA选择安装版本)
    • 3.安装mmdetection
  • 三、验证(测试)
  • 总结
  • 参考


前言

深度学习目标检测工具箱mmdetection,支持Faster-RCNN,Mask-RCNN,Fast-RCNN等主流的目标检测框架。


提示:以下是本篇文章正文内容,下面案例可供参考

一、安装前准备

   1. 已安装好Pytorch环境
   2. 选择mmcv—安装mmcv或者mmcv-full,其中mmcv是CPU版本,mmcv-full是GPU版本,根据Pytorch和CUDA版本选择合适的mmcv-full版本:
   网站:https://download.openmmlab.com/mmcv/dist/index.html


二、安装 1.Pytorch安装

   参考 深度学习系列之环境配置(i7-10700 + RTX3080+32G+500G)

2.安装mmcv-full(根据CUDA选择安装版本)

   网上说,我也这么操作了,毕竟是安装mmcv-full。首先conda环境中查看是否安装了mmcv,输入pip list ,然后卸载环境中已经存在的mmcv,输入 pip uninstall mmcv
   安装方式1:选择对应版本安装(本人选择)

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

  参考cuda选择(本文安装选择):mmcv_full-1.2.0+torch1.7.0+cu110-cp37-cp37m-manylinux1_x86_64.whl

   安装方式2:官网下载github源码安装(github里有安装手册)

git clone https://github.com/open-mmlab/mmcv.git
3.安装mmdetection
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements
python setup.py develop

  参考文件夹目录

三、验证(测试)

   1.测试文件准备
   下载权重文件放在下面“测试”新建文件夹checkpoints文件夹中,新建测试代码()如下,其中configs、demo官方下载文件已经包含。

wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth

   2.测试代码

from mmdet.apis import init_detector, inference_detector,show_result_pyplot
import matplotlib
matplotlib.use('TkAgg')  
import matplotlib.pyplot as plt

config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: https://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
img= 'demo/demo.jpg'
result = inference_detector(model, img)
show_result_pyplot(model, img, result)

   测试图片

   测试结果


总结

   还好很顺利,一次安装成功,如有不足,请留言指正 ,谢谢!

参考

1.mmdetection官方安装流程

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/892419.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号