大家好,欢迎来到IT知识分享网。
RPN网络前面是一个提特征的网络,比如VGG,Res等,传给RPN网络的是一个特征图,RPN网络首先加了一个3*3*256*256的卷积层,之后在这个卷积之后,各自接了两个全连接层,一个输出18,一个输出36
输出特征图:13*13*256
- #========= RPN ============
- # 到我们的RPN网络部分了,前面的都是共享的5层卷积层的部分
- layer {
- name: “rpn_conv1”
- type: “Convolution”
- bottom: “conv5” #caffe中的数据是用blobs的形式进行数据流动的,每一层用bottom来输入数据,用top来输出数据。如果只有top没有bottom,则此层只有输出,没有输入。反之亦然。如果有多个 top或多个bottom,表示有多个blobs数据的输入和输出。
- top: “rpn_conv1”
- param { lr_mult: 1.0 }
- param { lr_mult: 2.0 }
- convolution_param {
- num_output: 256
- kernel_size: 3 pad: 1 stride: 1 #这里作者把每个滑窗3*3,通过3*3*256*256的卷积核输出256维,完整的输出其实是12*12*256,
- weight_filler { type: “gaussian” std: 0.01 }
- bias_filler { type: “constant” value: 0 }
- }
- }
- layer {
- name: “rpn_relu1”
- type: “ReLU”
- bottom: “rpn_conv1”
- top: “rpn_conv1”
- }
- layer {
- name: “rpn_cls_score”
- type: “Convolution”
- bottom: “rpn_conv1”
- top: “rpn_cls_score”
- param { lr_mult: 1.0 }
- param { lr_mult: 2.0 }
- convolution_param {
- num_output: 18 # 2(bg/fg) * 9(anchors)
- kernel_size: 1 pad: 0 stride: 1 #这里看的很清楚,作者通过1*1*256*18的卷积核,将前面的256维数据转换成了18个输出
- weight_filler { type: “gaussian” std: 0.01 }
- bias_filler { type: “constant” value: 0 }
- }
- }
- layer {
- name: “rpn_bbox_pred”
- type: “Convolution”
- bottom: “rpn_conv1”
- top: “rpn_bbox_pred”
- param { lr_mult: 1.0 }
- param { lr_mult: 2.0 }
- convolution_param {
- num_output: 36 # 4 * 9(anchors)
- kernel_size: 1 pad: 0 stride: 1 <span style=”font-family: Arial, Helvetica, sans-serif;”>#这里看的很清楚,作者通过1*1*256*36的卷积核,将前面的256维数据转换成了36个输出</span>
- weight_filler { type: “gaussian” std: 0.01 }
- bias_filler { type: “constant” value: 0 }
- }
- }
- layer {
- bottom: “rpn_cls_score”
- top: “rpn_cls_score_reshape” # 我们之前说过,其实这一层是12*12*256的,所以后面我们要送给损失函数,需要将这个矩阵reshape一下,我们需要的是144个滑窗,每个对应的256的向量
- name: “rpn_cls_score_reshape”
- type: “Reshape” ##改变数据的维度
- reshape_param { shape { dim: 0 dim: 2 dim: -1 dim: 0 } }
- }
- layer {
- name: ‘rpn-data’
- type: ‘Python’
- bottom: ‘rpn_cls_score’
- bottom: ‘gt_boxes’
- bottom: ‘im_info’
- bottom: ‘data’
- top: ‘rpn_labels’
- top: ‘rpn_bbox_targets’
- top: ‘rpn_bbox_inside_weights’
- top: ‘rpn_bbox_outside_weights’
- python_param {
- module: ‘rpn.anchor_target_layer’
- layer: ‘AnchorTargetLayer’ ###产生anchor,并对anchor进行评分等操作。
- param_str: “‘feat_stride’: 16”
- }
- }
- layer {
- name: “rpn_loss_cls”
- type: “SoftmaxWithLoss” # 很明显这里是计算softmax的损失,输入labels和cls layer的18个输出(中间reshape了一下),输出损失函数的具体值
- bottom: “rpn_cls_score_reshape”
- bottom: “rpn_labels”
- propagate_down: 1
- propagate_down: 0
- top: “rpn_cls_loss”
- loss_weight: 1
- loss_param {
- ignore_label: -1
- normalize: true
- }
- }
- layer {
- name: “rpn_loss_bbox”
- type: “SmoothL1Loss” # 这里计算的框回归损失函数具体的值
- bottom: “rpn_bbox_pred”
- bottom: “rpn_bbox_targets”
- bottom: “rpn_bbox_inside_weights”
- bottom: “rpn_bbox_outside_weights”
- top: “rpn_loss_bbox”
- loss_weight: 1
- smooth_l1_loss_param { sigma: 3.0 }
- }
- #========= RCNN ============
- # Dummy layers so that initial parameters are saved into the output net
- layer {
- name: “dummy_roi_pool_conv5”
- type: “DummyData”
- top: “dummy_roi_pool_conv5”
- dummy_data_param {
- shape { dim: 1 dim: 9216 }
- data_filler { type: “gaussian” std: 0.01 }
- }
- }
- layer {
- name: “fc6”
- type: “InnerProduct”
- bottom: “dummy_roi_pool_conv5”
- top: “fc6”
- param { lr_mult: 0 decay_mult: 0 }
- param { lr_mult: 0 decay_mult: 0 }
- inner_product_param {
- num_output: 4096
- }
- }
- layer {
- name: “relu6”
- type: “ReLU”
- bottom: “fc6”
- top: “fc6”
- }
- layer {
- name: “fc7”
- type: “InnerProduct”
- bottom: “fc6”
- top: “fc7”
- param { lr_mult: 0 decay_mult: 0 }
- param { lr_mult: 0 decay_mult: 0 }
- inner_product_param {
- num_output: 4096
- }
- }
- layer {
- name: “silence_fc7”
- type: “Silence”
- bottom: “fc7”
- }
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/24284.html