示例#1
0
    def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
        with tf.variable_scope(name) as scope:
            rois, rpn_scores = proposal_layer_tf(rpn_cls_prob, rpn_bbox_pred, self._im_info,
                            self._feat_stride, self._anchors, self._num_anchors)

        rois.set_shape([None, 6])
        rpn_scores.set_shape([None, 1])
        rpn_scores = tf.to_float(rpn_scores)

        return rois, rpn_scores
def _proposal_layer(rpn_cls_prob, rpn_bbox_pred, name):
    with tf.variable_scope(name) as scope:

        rois, rpn_scores = proposal_layer_tf(rpn_cls_prob, rpn_bbox_pred,
                                             imgsize_placeholder, mode,
                                             feat_stride, anchors, num_anchors)

    rois.set_shape([None, 5])
    rpn_scores.set_shape([None, 1])

    return rois, rpn_scores
示例#3
0
    def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
        with tf.variable_scope(name) as scope:
            if cfg.USE_E2E_TF:
                rois, rpn_scores = proposal_layer_tf(rpn_cls_prob,rpn_bbox_pred,self._im_info,self._mode,self._feat_stride,
                    self._anchors,self._num_anchors)  #筛选超越边界的候选框,进行nms处理,得到前6k个候选框
            else:
                rois, rpn_scores = tf.py_func(proposal_layer,[rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                                               self._feat_stride, self._anchors, self._num_anchors],
                                              [tf.float32, tf.float32], name="proposal")

            rois.set_shape([None, 5])  #[w*h*9,5]
            rpn_scores.set_shape([None, 1])  #[w*h*9,1]

        return rois, rpn_scores
示例#4
0
 def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
     # 生成rois,roi_scores
     with tf.variable_scope(name) as scope:
         if cfg.USE_E2E_TF:
             rois, rpn_scores = proposal_layer_tf(
                 rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                 self._feat_stride, self._anchors, self._num_anchors)
         else:
             rois, rpn_scores = tf.py_func(proposal_layer, [
                 rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                 self._feat_stride, self._anchors, self._num_anchors
             ], [tf.float32, tf.float32],
                                           name='proposal')
         rois.set_shape([None, 5])
         rpn_scores.set_shape([None, 1])
     return rois, rpn_scores
示例#5
0
    def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
        '''given rpn classification prob and bbox offset prediction to get 2000 rois'''
        with tf.variable_scope(name) as scope:
            if cfg.USE_E2E_TF:
                rois, rpn_scores = proposal_layer_tf(
                    rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                    self._feat_stride, self._anchors, self._num_anchors)
            else:
                rois, rpn_scores = tf.py_func(proposal_layer, [
                    rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                    self._feat_stride, self._anchors, self._num_anchors
                ], [tf.float32, tf.float32],
                                              name="proposal")

            rois.set_shape([None, 5])
            rpn_scores.set_shape([None, 1])

        return rois, rpn_scores
示例#6
0
        def _proposal_layer(inputs):
            build_rpn_cls_prob, build_rpn_bbox_pred, build_anchors, im_info = inputs
            im_info = im_info[0]
            with tf.variable_scope(name) as scope:
                if cfg.USE_E2E_TF:
                    rois, rpn_scores = proposal_layer_tf(
                        build_rpn_cls_prob, build_rpn_bbox_pred, im_info,
                        self._mode, self._feat_stride, build_anchors,
                        self._num_anchors)
                else:
                    rois, rpn_scores = tf.py_func(proposal_layer, [
                        build_rpn_cls_prob, build_rpn_bbox_pred, im_info,
                        self._mode, self._feat_stride, build_anchors,
                        self._num_anchors
                    ], [tf.float32, tf.float32],
                                                  name="proposal")

                rois.set_shape([None, 5])
                rpn_scores.set_shape([None, 1])

                return [rois, rpn_scores]
示例#7
0
  def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
    with tf.variable_scope(name) as scope:
      if cfg.USE_E2E_TF:
        rois, rpn_scores = proposal_layer_tf(
          rpn_cls_prob,
          rpn_bbox_pred,
          self._im_info,
          self._mode,
          self._feat_stride,
          self._anchors,
          self._num_anchors
        )
      else:
        rois, rpn_scores = tf.py_func(proposal_layer,
                              [rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                               self._feat_stride, self._anchors, self._num_anchors],
                              [tf.float32, tf.float32], name="proposal")

      rois.set_shape([None, 5])
      rpn_scores.set_shape([None, 1])

    return rois, rpn_scores
示例#8
0
  def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
    with tf.variable_scope(name) as scope:
      if cfg.USE_E2E_TF:
        #筛选出大约2k个预测的候选框
        rois, rpn_scores = proposal_layer_tf(
          rpn_cls_prob,
          rpn_bbox_pred,
          self._im_info,
          self._mode,
          self._feat_stride,
          self._anchors,
          self._num_anchors
        )
      else:
        rois, rpn_scores = tf.py_func(proposal_layer,
                              [rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                               self._feat_stride, self._anchors, self._num_anchors],
                              [tf.float32, tf.float32], name="proposal")

      rois.set_shape([None, 5]) #(2k,5):[0,x1,y1,x2,y2]
      rpn_scores.set_shape([None, 1]) #(2k,1)

    return rois, rpn_scores
示例#9
0
    def _proposal_layer(self, rpn_cls_prob, rpn_bbox_pred, name):
        """
        # get anchor score and coor, anchors filter,mns提取rois
        :param rpn_cls_prob:
        :param rpn_bbox_pred:
        :param name:
        :return:
        """
        with tf.variable_scope(name) as scope:
            if cfg.USE_E2E_TF:
                rois, rpn_scores = proposal_layer_tf(
                    rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                    self._feat_stride, self._anchors, self._num_anchors)
            else:
                rois, rpn_scores = tf.py_func(proposal_layer, [
                    rpn_cls_prob, rpn_bbox_pred, self._im_info, self._mode,
                    self._feat_stride, self._anchors, self._num_anchors
                ], [tf.float32, tf.float32],
                                              name="proposal")

            rois.set_shape([None, 5])
            rpn_scores.set_shape([None, 1])

        return rois, rpn_scores