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

open-mmlab labelImg mmdetection

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

open-mmlab labelImg mmdetection

open-mmlab的检测项目
  • 数据标柱工具介绍
    • labelImg
      • 安装(两种方法都适用于linux和mac上的conda虚拟环境下安装)
        • pip包安装
        • 从源码安装
  • mmdetection
    • 配置环境
    • 运行
  • mmsegmentation

数据标柱工具介绍 labelImg

git地址: https://github.com/tzutalin/labelImg

安装(两种方法都适用于linux和mac上的conda虚拟环境下安装)

根据git上介绍,有两种安装方法:

pip包安装

pip包安装(linux上最简单的安装方法),安装命令及使用命令如下:

# 环境准备
conda create -n labelImg_1 python=3.7
conda activate labelImg_1
# linux安装
pip3 install labelImg
# linux使用vnc打开可视化界面。命令行输入如下:
labelImg
#
labelImg [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

使用pip list查看安装包

pip list
Package    Version
---------- ---------
certifi    2021.10.8
labelImg   1.8.6
lxml       4.6.3
pip        21.0.1
PyQt5      5.15.5
PyQt5-Qt5  5.15.2
PyQt5-sip  12.9.0
setuptools 58.0.4
wheel      0.37.0

软件截图如下

从源码安装

下载源代码,准备虚拟环境

# 环境准备
conda create -n labelImg_2 python==3.7
conda activate labelImg_2
pip install PyQt5
pip install lxml
pyrcc5 -o libs/resources.py resources.qrc
# 下载
git clone https://github.com/tzutalin/labelImg
cd labelImg
# 使用
python3 labelImg.py
#
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

使用pip list查看安装包

pip list
Package    Version
---------- ---------
certifi    2021.10.8
lxml       4.6.3
pip        21.2.2
PyQt5      5.15.5
PyQt5-Qt5  5.15.2
PyQt5-sip  12.9.0
setuptools 58.0.4
wheel      0.37.0

软件截图如下

mmdetection

git地址: https://github.com/open-mmlab/mmdetection

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

下载到服务器,更新到本地,用pycharm编辑器打开(参考https://blog.csdn.net/fighting_Kitty/article/details/121023315)

配置环境

找到readme中Installation,get_started.md中详细写了环境安装,主要命令如下:

# 创建虚拟环境
conda create -n openmmlab python=3.7 -y
conda activate openmmlab
# 安装PyTorch and torchvision
#(按照自己的cuda版本(nvcc -V)
# 去pytorch官网上选https://pytorch.org/get-started/previous-versions/)
# CUDA 11.0
pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
# Install MMDetection(自动或者手动,自动简单,手动适合调试研究代码)
pip install openmim
mim install mmdet

# 手动
pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio==0.7.0  -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/1.7.1+cu110/index.htm



附:cuda查看nvcc -V

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Thu_Jun_11_22:26:38_PDT_2020
Cuda compilation tools, release 11.0, V11.0.194
Build cuda_11.0_bu.TC445_37.28540450_0
运行
mkdir checkpoints
cd checkpoints
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
wget https://github.com/open-mmlab/mmdetection/tree/master/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py

代码

from mmdet.apis import init_detector, inference_detector

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
inference_detector(model, '../demo/demo.jpg')

mmsegmentation

git地址: https://github.com/open-mmlab/mmdetection

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

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

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