MaskRCNN RPN网络分析
在每个锚生成5种大小和3种形状的候选框(每层特征对应一种大小,每个锚点对应3种形状)。并进行两层卷积后,做前景与背景的分类,与候选框的偏移量回归。与目标重叠> = 0.7则为前景,与目标重叠<= 0.3则为背景,其余框去掉。
############################################################
# Region Proposal Network (RPN)
############################################################def rpn_graph(feature_map, anchors_per_location, anchor_stride):"""Builds the computation graph of Region Proposal Network.feature_map: backbone features [batch, height, width, depth]anchors_per_location: number of anchors per pixel in the feature mapanchor_stride: Controls the density of anchors. Typically 1 (anchors forevery pixel in the feature map), or 2 (every other pixel).Returns:rpn_class_logits: [batch, H * W * anchors_per_location, 2] Anchor classifier logits (before softmax)rpn_probs: [batch, H * W * anchors_per_location, 2] Anchor classifier probabilities.rpn_bbox: [batch, H * W * anchors_per_location, (dy, dx, log(dh), log(dw))] Deltas to beapplied to anchors."""# TODO: check if stride of 2 causes alignment issues if the feature map# is not even.# Shared convolutional base of the RPN# 对特征图做一个(3, 3)卷积,结果大小[batch, height, width, depth]shared = KL.Conv2D(512, (3, 3), padding='same', activation='relu',strides=anchor_stride,name='rpn_conv_shared')(feature_map)# Anchor Score. [batch, height, width, anchors per location * 2].# anchors_per_location=3,3种锚点比例x = KL.Conv2D(2 * anchors_per_location, (1, 1), padding='valid',activation='linear', name='rpn_class_raw')(shared)# Reshape to [batch, anchors, 2]# 背景和前景做分类rpn_class_logits = KL.Lambda(lambda t: tf.reshape(t, [tf.shape(t)[0], -1, 2]))(x)# Softmax on last dimension of BG/FG.# 分类 背景和前景,做softmax处理rpn_probs = KL.Activation("softmax", name="rpn_class_xxx")(rpn_class_logits)# Bounding box refinement. [batch, H, W, anchors per location * depth]# where depth is [x, y, log(w), log(h)]# 边框优化,activation='linear'线性激活函数x = KL.Conv2D(anchors_per_location * 4, (1, 1), padding="valid",activation='linear', name='rpn_bbox_pred')(shared)# Reshape to [batch, anchors, 4]# 4个框坐标rpn_bbox = KL.Lambda(lambda t: tf.reshape(t, [tf.shape(t)[0], -1, 4]))(x)return [rpn_class_logits, rpn_probs, rpn_bbox]def build_rpn_model(anchor_stride, anchors_per_location, depth):"""Builds a Keras model of the Region Proposal Network.It wraps the RPN graph so it can be used multiple times with sharedweights.anchors_per_location: number of anchors per pixel in the feature mapanchor_stride: Controls the density of anchors. Typically 1 (anchors forevery pixel in the feature map), or 2 (every other pixel).depth: Depth of the backbone feature map.Returns a Keras Model object. The model outputs, when called, are:rpn_class_logits: [batch, H * W * anchors_per_location, 2] Anchor classifier logits (before softmax)rpn_probs: [batch, H * W * anchors_per_location, 2] Anchor classifier probabilities.rpn_bbox: [batch, H * W * anchors_per_location, (dy, dx, log(dh), log(dw))] Deltas to beapplied to anchors."""input_feature_map = KL.Input(shape=[None, None, depth],name="input_rpn_feature_map")outputs = rpn_graph(input_feature_map, anchors_per_location, anchor_stride)return KM.Model([input_feature_map], outputs, name="rpn_model")
MaskRCNN RPN网络分析相关推荐
- YOLO、SSD、FPN、Mask-RCNN检测模型对比
YOLO.SSD.FPN.Mask-RCNN检测模型对比 一.YOLO(you only look once) YOLO 属于回归系列的目标检测方法,与滑窗和后续区域划分的检测方法不同,他把检测任务当 ...
- Mask-RCNN技术解析
Mask-RCNN技术解析 MaskR-CNN 论文链接:https://arxiv.org/pdf/1703.06870.pdf 代码链接:https://github.com/CharlesSha ...
- Mask-RCNN论文解读
点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 Mask R-CNN介绍 Mask R-CNN是基于Faster ...
- 使用Mask-RCNN在实例分割应用中克服过拟合
点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 本文转自AI公园 作者:Kayo Yin 编译:ronghuaiy ...
- 收藏 | 使用Mask-RCNN在实例分割应用中克服过拟合
点击上方"3D视觉工坊",选择"星标" 干货第一时间送达 转载于:作者:Kayo Yin 编译:ronghuaiyang | AI公园 导读 只使 ...
- DL之MaskR-CNN:Mask R-CNN算法的简介(论文介绍)、架构详解、案例应用等配图集合之详细攻略
DL之MaskR-CNN:Mask R-CNN算法的简介(论文介绍).架构详解.案例应用等配图集合之详细攻略 目录 Mask R-CNN算法的简介(论文介绍) 0.实验结果 1.实例分割具有挑战性 2 ...
- MaskRCNN要点
faster-rcnn网络结构 MaskRCNN的网络框架 其中黑色部分为原来的 Faster-RCNN,红色部分为在 Faster网络上的修改: 1)将 Roi Pooling 层替换成了 RoiA ...
- 收藏 | 使用 Mask-RCNN 在实例分割应用中克服过拟合
点上方蓝字计算机视觉联盟获取更多干货 在右上方 ··· 设为星标 ★,与你不见不散 仅作学术分享,不代表本公众号立场,侵权联系删除 转载于:作者 | Kayo Yin 编译 | ronghuaiyan ...
- mask rcnn属于dnn么_基于OpenCV DNN的 MaskRCNN 目标检测与实例分割
这里主要记录基于 OpenCV 4.x DNN 模块和 TensorFlow MaskRCNN 开源模型的目标检测与实例分割 的实现. MaskRCNN 不仅可以检测图片或视频帧中的物体边界框,还可以 ...
最新文章
- python读取文件
- java 引用传递_详解java的值传递、地址传递、引用传递
- idea中maven导入jar包
- Objective-C 中Socket常用转换机制(NSData,NSString,int,Uint8,Uint16,Uint32,byte[])
- Android持久化存储(4)greenDAO的使用
- 文件上传之Springmvc方式上传原理分析
- 服务器显示AL018是什么意思,IIS服务器80端口却已被占用的问题
- Spring Data Solr教程:将自定义方法添加到单个存储库
- 秦九韶算法matlab实验报告,数值分析上机实验报告.doc
- Python 第三方扩展库
- sed,awk,grep学习笔记
- Linux下一次数据仓库进行迁移记录
- 微信小程序倒计时组件开发
- 维特智能陀螺仪角度传感器原理
- 中国大学生学习与发展追踪研究(2007年至今)与中国综合社会调查(2003-2017年)与中国社会状况综合调查(2006-2019年)
- php音乐云盘,百度云盘音乐、文件、图片外链的三个方法总结
- android个人记账本的实验报告,(会计登记账簿实验报告.doc
- 【win11】解决win11家庭版没有组策略编辑器
- CS231n学习笔记-损失函数、损失函数与梯度下降
- 重载、重定义、虚函数