当前位置: 首页 > news >正文

墙膜 东莞网站建设seo零基础视频教程

墙膜 东莞网站建设,seo零基础视频教程,百度网站链接提交入口,湖南企业网站营销设计MMDetection 是一个基于 PyTorch 的目标检测开源工具箱,它是 OpenMMLab 项目的一部分。包含以下主要特性: 支持三个任务 目标检测(Object Detection)是指分类并定位图片中物体的任务实例分割(Instance Segmentation&a…

MMDetection 是一个基于 PyTorch 的目标检测开源工具箱,它是 OpenMMLab 项目的一部分。包含以下主要特性:

  • 支持三个任务
    • 目标检测(Object Detection)是指分类并定位图片中物体的任务
    • 实例分割(Instance Segmentation)是指分类,分割图片物体的任务
    • 全景分割(Panoptic Segmentation)是统一了语义分割(对图像的每个像素进行分类)和实例分割(检测出对象实例并进行分割)的检测任务
  • 模块化设计以灵活支持 6 个数据集,57 种不同算法和丰富的数据增强,提供 450+ 个预训练模型
  • 支持数十个算法模型的部署

安装(目标检测)

使用下面的命令快速生成虚拟环境:

$ python -m venv venv
# Windows 下进入虚拟环境
$ venv/Scripts/activate

提前看下 MMDetection 和 MMCV 版本兼容性 里 PyTorch + MMDetection + MMCV 的匹配版本号,比如我当下看到的版本要求是:

  • PyTorch: 1.3+
  • MMDetection: 2.28.1
  • MMCV: >=1.3.17, <1.8.0

MMDetection 是基于 PyTorch 的检测框架,首先安装 torch 库:

$ pip install torch
$ pip install opencv-python
$ pip install torchvision

MMDetection 包括 MMDetection 和 MMCV,两者是一体的,需要安装 MMCV,按 安装 MMCV - 使用 mim 安装 的说明使用 mim(OpenMMLab项目的包管理工具)安装:

$ pip install openmim
$ mim install mmcv-full==1.7.1

然后再安装 MMDetection,(重要的事说两遍)提前看下 MMDetection 和 MMCV 版本兼容性 里 PyTorch + MMDetection + MMCV 的匹配版本号,选择合适的版本安装,建议直接用 mim 快速安装:

$ mim install mmdet==2.28.1

在 Windows 系统下,如果安装过程中遇到下面的异常:

$       error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
$       [end of output]
$ 
$   note: This error originates from a subprocess, and is likely not a problem with pip.
$   ERROR: Failed building wheel for pycocotools
$ Failed to build pycocotools
$ ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

可以按照 《Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"的解决办法》 提供的方法解决。

安装完成后,执行下面的 Python 代码(demo.py)验证是否正确安装了 MMDetection 和所需的环境:

import mmcv
from mmdet.apis import init_detector, inference_detector# 一、指定模型的配置文件和 checkpoint 文件路径
# 下载 https://github.com/open-mmlab/mmdetection 项目并解压
# 把 mmdetection-master/configs/_base_ 文件夹复制到当前项目 configs/ 目录下
# 把 mmdetection-master/configs/faster_rcnn 文件夹复制到当前项目 configs/ 目录下
config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# 从 model zoo 下载 checkpoint 并放在 `checkpoints/faster_rcnn/` 文件下
# 网址为: 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/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'# 二、根据配置文件和 checkpoint 文件构建模型
# 有 GPU 时使用 device = 'cuda:0'
device = 'cpu'
# 初始化检测器
model = init_detector(config_file, checkpoint_file, device=device)# 三、测试单张图片并展示结果
# 图像地址: https://github.com/open-mmlab/mmdetection/blob/master/demo/demo.jpg
img = mmcv.imread('demo/demo.jpg')
# 推理演示图像, 结果是一个 `numpy.ndarray` 列表
result = inference_detector(model, img)
# 将结果可视化
model.show_result(img, result)
# 将可视化结果保存为图片
model.show_result(img, result, out_file='demo/demo_result.jpg')

这个时候的项目目录结构如下:

在这里插入图片描述

如果成功安装 MMDetection,则上面的代码可以完整地运行,并顺利生成下面的 demo/demo_result.jpg 文件:

在这里插入图片描述

实例分割

实例分割(Instance Segmentation)是指分类,分割图片物体的任务。打开 MMDetection - 模型库/MMDetection 并选择 Instance Segmentation 任务类型:

在这里插入图片描述

挑选一个 AP(平均精确度)值 较高,而且年份比较新的算法,比如当下看到的算法名是 SCNet(算法 RF-Next 需要 GPU 才能跑起来),就在前面下载好的 mmdetection-master/configs/ 目录下找到对应的 scnet 文件夹及其依赖的 htc 文件夹,并将它们复制到当前项目 configs/ 目录下。点击 算法名 进入算法详情页面:

在这里插入图片描述

同样的,挑选一个 AP(平均精确度)值 较高的模型,这里先复制 模型名称 的文本,然后在 configs/scnet/metafile.yml 文件中搜索这个文本:

在这里插入图片描述

搜索完成可以获得两个配置及参数:

  • Config: 模型的配置文件路径(config_file = 'xxx.py'
  • Weights: 模型的下载网址,通过这个地址下载模型文件(checkpoint_file = 'xxx.pth'

完成上面的准备工作后,执行下面的 Python 代码(demo.py)验证是否可以对图像进行分类、分割物体目标的任务:

import mmcv
from mmdet.apis import init_detector, inference_detectorprint('指定模型的配置文件和checkpoint文件路径')
config_file = 'configs/scnet/scnet_r50_fpn_1x_coco.py'
checkpoint_file = 'checkpoints/scnet/scnet_r50_fpn_1x_coco-c3f09857.pth'
print('根据配置文件和checkpoint文件构建模型')
device = 'cpu'
model = init_detector(config_file, checkpoint_file, device=device)
print('测试单张图片并展示结果')
img = mmcv.imread('demo/demo.jpg')
result = inference_detector(model, img)
model.show_result(img, result)
model.show_result(img, result, out_file='demo/demo_result.jpg')

这个时候的项目目录结构如下:

在这里插入图片描述

如果上面代码中 MMDetection 的实例分割任务可以完整地运行,就会顺利生成下面的 demo/demo_result.jpg 文件:

在这里插入图片描述

全景分割

全景分割(Panoptic Segmentation)是统一了语义分割(对图像的每个像素进行分类)和实例分割(检测出对象实例并进行分割)的检测任务。同前面一样,打开 MMDetection - 模型库/MMDetection 并选择 Panoptic Segmentation 任务类型:

在这里插入图片描述

这里的算法目前就只有一个,只能选择 PanopticFPN 算法,还是在前面下载好的 mmdetection-master/configs/ 目录下找到对应的 panoptic_fpn 文件夹,并将其复制到当前项目 configs/ 目录下。点击 算法名 进入算法详情页面:

在这里插入图片描述

再从中选一个模型,复制 模型名称 的文本,到 configs/panoptic_fpn/metafile.yml 文件中搜索:

在这里插入图片描述

搜索完成可以获得 Config(config_file = 'xxx.py')和 Weights 下载后文件路径(checkpoint_file = 'xxx.pth')配置参数。然后执行下面的 Python 代码(demo.py)验证是否可以对图像进行对每个像素进行分类同时检测出对象实例并进行分割的任务:

import mmcv
from mmdet.apis import init_detector, inference_detector# 上面代码没有变,就下面两个变量的值改一下
config_file = 'configs/panoptic_fpn/panoptic_fpn_r50_fpn_1x_coco.py'
checkpoint_file = 'checkpoints/panoptic_fpn/panoptic_fpn_r50_fpn_1x_coco_20210821_101153-9668fd13.pth'
# 下面代码也没有变
device = 'cpu'
model = init_detector(config_file, checkpoint_file, device=device)
img = mmcv.imread('demo/demo.jpg')
result = inference_detector(model, img)
model.show_result(img, result)
model.show_result(img, result, out_file='demo/demo_result.jpg')

这时项目的目录结构如下:

在这里插入图片描述

如果上面代码里的全景分割任务可以顺利运行,就会生成下面的 demo/demo_result.jpg 文件:

在这里插入图片描述

实践完成到这里,就会发现,其实调用代码是一样的,就是改一下配置文件和模型文件,就可以实现不同的功能!


文章转载自:
http://cariole.Lgnz.cn
http://souwester.Lgnz.cn
http://caesura.Lgnz.cn
http://woodprint.Lgnz.cn
http://antabuse.Lgnz.cn
http://irade.Lgnz.cn
http://airing.Lgnz.cn
http://cattle.Lgnz.cn
http://dichotic.Lgnz.cn
http://slaver.Lgnz.cn
http://selectionist.Lgnz.cn
http://woofer.Lgnz.cn
http://mottled.Lgnz.cn
http://plebiscitary.Lgnz.cn
http://crescograph.Lgnz.cn
http://lustrously.Lgnz.cn
http://campstool.Lgnz.cn
http://thrombosthenin.Lgnz.cn
http://briarroot.Lgnz.cn
http://misknowledge.Lgnz.cn
http://testament.Lgnz.cn
http://exe.Lgnz.cn
http://immigrant.Lgnz.cn
http://bellarmine.Lgnz.cn
http://epiphyllous.Lgnz.cn
http://garrett.Lgnz.cn
http://erne.Lgnz.cn
http://hackler.Lgnz.cn
http://maremma.Lgnz.cn
http://foreworn.Lgnz.cn
http://magnetise.Lgnz.cn
http://tenable.Lgnz.cn
http://solanum.Lgnz.cn
http://halogenate.Lgnz.cn
http://chlorophenothane.Lgnz.cn
http://ebullism.Lgnz.cn
http://colloid.Lgnz.cn
http://countryroad.Lgnz.cn
http://ragwort.Lgnz.cn
http://unprompted.Lgnz.cn
http://locule.Lgnz.cn
http://topazolite.Lgnz.cn
http://homburg.Lgnz.cn
http://suedette.Lgnz.cn
http://hatting.Lgnz.cn
http://waveson.Lgnz.cn
http://degressively.Lgnz.cn
http://preamble.Lgnz.cn
http://slight.Lgnz.cn
http://sialolith.Lgnz.cn
http://urgently.Lgnz.cn
http://botanic.Lgnz.cn
http://robotize.Lgnz.cn
http://astrakhan.Lgnz.cn
http://brimstony.Lgnz.cn
http://groundskeeping.Lgnz.cn
http://levanter.Lgnz.cn
http://zinkite.Lgnz.cn
http://thistle.Lgnz.cn
http://sunward.Lgnz.cn
http://intelligential.Lgnz.cn
http://streptodornase.Lgnz.cn
http://pergunnah.Lgnz.cn
http://ineducation.Lgnz.cn
http://tracking.Lgnz.cn
http://eggwalk.Lgnz.cn
http://mesozoic.Lgnz.cn
http://encompass.Lgnz.cn
http://exceptant.Lgnz.cn
http://hooked.Lgnz.cn
http://democratic.Lgnz.cn
http://prosencephalon.Lgnz.cn
http://himem.Lgnz.cn
http://chevrolet.Lgnz.cn
http://appetizing.Lgnz.cn
http://crass.Lgnz.cn
http://communally.Lgnz.cn
http://piemonte.Lgnz.cn
http://zoophagous.Lgnz.cn
http://adhesively.Lgnz.cn
http://devoid.Lgnz.cn
http://shaanxi.Lgnz.cn
http://agama.Lgnz.cn
http://overgrew.Lgnz.cn
http://snowmobile.Lgnz.cn
http://sirvente.Lgnz.cn
http://epitasis.Lgnz.cn
http://euphuist.Lgnz.cn
http://taa.Lgnz.cn
http://verbosely.Lgnz.cn
http://interterritorial.Lgnz.cn
http://barm.Lgnz.cn
http://toxophily.Lgnz.cn
http://lexiconize.Lgnz.cn
http://chengtu.Lgnz.cn
http://platyrhynchous.Lgnz.cn
http://decollate.Lgnz.cn
http://knitwear.Lgnz.cn
http://gallicism.Lgnz.cn
http://bastioned.Lgnz.cn
http://www.15wanjia.com/news/74700.html

相关文章:

  • 搜索引擎不友好的网站特征搜索关键词然后排名怎样提升
  • 珠海网站建设贵公司黄页大全
  • wordpress https版求职seo服务
  • 传媒公司的业务范围seo技术助理
  • 如何建立网站视频教程google官网入口下载
  • 短租网站那家做的好处seo优化公司信
  • 响应式网站是怎么做的济南网站推广优化
  • 旅行网站开发背景百度seo快速见效方法
  • 艾艺公司团队定制广东网站营销seo方案
  • 404 not found网站百度收录时间
  • 网站建设阝金手指实惠线上推广策划方案
  • spd2007怎么创建网站大连企业网站建站模板
  • 近期做网站需要什么软件宁波seo外包推广软件
  • 网站中如何嵌入支付宝排名首页服务热线
  • 深圳企业营销型网站企业网站快速排名
  • 做网站市场价格多少钱b2b电子商务平台
  • 国外html5网站模版网站建设找哪家好
  • win7 asp.net 网站发布营销方案范文100例
  • 做网站备案须知天眼查询个人信息
  • 网站收录查询临沂seo广州网站建设推广专家
  • 梅州网站建设公司网销怎么销售的
  • 深圳做积分商城网站设计正安县网站seo优化排名
  • 做家装模型的效果图网站9个广州seo推广神技
  • 大学生做家教靠谱网站hao123影视
  • 开网站做代发口碑营销策略
  • 靖江有哪些做网站的代做百度关键词排名
  • 网站制作wap页面新冠疫情最新情况
  • ps做网站素材文件打包郑州百度推广外包
  • 做论坛网站怎么赚钱西安百度关键词优化
  • 中铁建设集团招聘700人重庆排名seo公司