当前位置:网站首页>"Record" MMDetection Introduction
"Record" MMDetection Introduction
2022-07-29 18:07:00 【ViatorSun】
OpenMMLabis a deep learning high-level library,通过OpenMMLab The software stack can be seen,The lower level is still used Pytorch,So the user is not learning a whole new library,but more advanced,更加方便的Pytorch库,OpenMMLabIt can bring higher efficiency to users,So that users can only focus on the core algorithm,Don't waste more time on configuration files
MMdet 主要由 4 个部分组成,datasets、models、core 和 apis
另外,MMCV is for the whole OpenMMLab All open source libraries,There are general classes and utility classes,Convenient for all downstream codebase 复用


backbone
mmdet/models/backbones
__all__ = [ 'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 'Res2Net',
'HourglassNet', 'DetectoRS_ResNet', 'DetectoRS_ResNeXt', 'Darknet',
'ResNeSt', 'TridentResNet' ]
通过 MMCV Registrar mechanism in ,你可以通过 dict form configuration to instantiate any registered class,非常方便和灵活.
# Pretrained weight paths for the skeleton
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet', # Skeleton class name,The following parameters are the initialization parameters of the class
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
neck
neck 可以认为是 backbone 和 head 的连接层,主要负责对 backbone The features are efficiently fused and enhanced,The input single-scale or multi-scale features can be fused、Enhanced output, etc.
mmdet/models/necks
__all__ = [
'FPN', 'BFP', 'ChannelMapper', 'HRFPN', 'NASFPN', 'FPN_CARAFE', 'PAFPN',
'NASFCOS_FPN', 'RFP', 'YOLOV3Neck'
]
最常用的应该是 FPN,A typical usage is:
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048], # 骨架多尺度特征图输出通道
out_channels=256, # 增强后通道输出
num_outs=5), # 输出num_outs个多尺度特征图
head
The output of the target detection algorithm generally includes two branches: classification and box coordinate regression,不同算法 head Modules vary in complexity,灵活度比较高.在网络构建方面,To understand the target detection algorithm is mainly to understand head 模块.
MMDetection 中 head Modules are divided into two-stage 所需的 RoIHead 和 one-stage 所需的 DenseHead,
- 所有的 one-stage 算法的 head 模块都在mmdet/models/dense_heads中
- 而 two-stage The algorithm also includes additional mmdet/models/roi_heads
Almost every algorithm includes a standalone head
# dense_heads:
__all__ = [
'AnchorFreeHead', 'AnchorHead', 'GuidedAnchorHead', 'FeatureAdaption',
'RPNHead', 'GARPNHead', 'RetinaHead', 'RetinaSepBNHead', 'GARetinaHead',
'SSDHead', 'FCOSHead', 'RepPointsHead', 'FoveaHead',
'FreeAnchorRetinaHead', 'ATSSHead', 'FSAFHead', 'NASFCOSHead',
'PISARetinaHead', 'PISASSDHead', 'GFLHead', 'CornerHead', 'YOLACTHead',
'YOLACTSegmHead', 'YOLACTProtonet', 'YOLOV3Head', 'PAAHead',
'SABLRetinaHead', 'CentripetalHead', 'VFNetHead', 'TransformerHead'
]
需要注意的是:two-stage 或者 mutli-stage 算法,Will additionally include a region extractor roi extractor,Used to convert different sizes RoI The feature maps are unified into the same size.
虽然 head Part of the network construction is relatively simple,But due to positive and negative sample property definition、Sum of positive and negative samples bbox 编解码模块都在 head A combined call is made in the module,故
MMDetection The most complex module in head.
下载配置文件
建议在 Conda环境中,在Pycharm中好像不能用,暂时还不知道是什么原因造成的
# 安装 mim
pip install openmim
mim search mmdet --model "mask r-cnn"
mim download mmdet --config "mask_rcnn_r50_fpn_2x_coco" --dest .
注意!--dest .
中间有空格
运行测试模型
from mmdet.apis import init_detector, inference_detector, train_detector, show_result_pyplot
from mmdet.datasets import build_dataset
from mmcv import Config
import mmcv
import os.path as osp
import multiprocessing
if __name__ == '__main__':
multiprocessing.freeze_support()
config_file = 'solo_r50_fpn_3x_coco.py'
checkpoint_file = 'solo_r50_fpn_3x_coco_20210901_012353-11d224d7.pth'
model = init_detector(config_file, checkpoint_file, device='cuda:0')
# print(model)
cfg = Config.fromfile(config_file)
dataset = [build_dataset(cfg.data.train)]
mmcv.mkdir_or_exist(osp.abspath('./work_dir_sum'))
train_detector(model, dataset, cfg, distributed=False, validate=False)
# 推理演示图像
result = inference_detector(model, '81.jpg')
show_result_pyplot(model,'81.jpg', result)
边栏推荐
- 观点:灵魂绑定NFT和去中心化社会
- Fast Reed-Solomon Interactive Oracle Proofs of Proximity学习笔记
- (notes) Build the was configured to -- Settings repositories over project repositories but solutions
- leetcode136 -- 只出现一次的数字
- Chicken and rabbit in the same cage
- 大佬们一个 sql 优化问题。我有个4千万的表。然后加了一个字段,只有10+条数据会给值,其他行数据
- 学会 arthas,让你 3 年经验掌握 5 年功力!
- canvas随机生成树木js特效
- js彩色树叶飘落动画js特效
- SSM整合案例分析(详解)
猜你喜欢
随机推荐
Fast Reed-Solomon Interactive Oracle Proofs of Proximity学习笔记
js选择多张图片对比功能插件
RocketQA: across batches negative sampling (cross - batch negatives), the denoising of strong negative cases of sampling (denoised hard negative from) and data to enhance (data augment
为什么mysql的count()方法这么慢?
【微信小程序】组件使用及属性参考
IDEA远程调试
query词权重, 搜索词权重计算
SR-TE的功能架构概述
leetcode141 -- 环形链表
wooden stick
阿里最新发布的《Alibaba分布式系统速成笔记》PDF版,供下载
NFTScan 与 PANews 联合发布多链 NFT 数据分析报告
Groeb - "gramm, explicit and complete n -" gramm mask language model, implements the explicit n - "gramm semantic unit modeling knowledge.
解析idea中的debug调试模式
[High Concurrency] I used multithreading to optimize the massive data proofreading system under the billion-level traffic e-commerce business, and the performance was directly improved by 200%!!(The w
TensorFlow Serving high-performance machine learning model of service system
对话加拿大工程院于非院士:寻找 AI 领域的「香农定理」
What is the GMAT test?
Loadrunner与Jmeter区别与相同
Pocket money