def setup(self, bottom, top):
        layer_params = yaml.load(self.param_str_)
        self._feat_stride = layer_params['feat_stride']
        self._anchors = generate_anchors()
        self._num_anchors = self._anchors.shape[0]
        self._use_clip = layer_params.get('use_clip', 0)
        self._clip_denominator = float(layer_params.get('clip_base', 256))
        self._clip_thresh = 1.0 / self._clip_denominator
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        self._top_name_map = {}

        top[0].reshape(1, 5)
        self._top_name_map['rois'] = 0

        if str(self.phase) == 'TEST':
            top[1].reshape(1, 441)
            self._top_name_map['init_states'] = 1

        # For MNC, we force the output proposals will also be used to train RPN
        # this is achieved by passing proposal_index to anchor_target_layer
        if str(self.phase) == 'TRAIN':
            if cfg.TRAIN.MIX_INDEX:
                top[1].reshape(1, 1)
                self._top_name_map['proposal_index'] = 1
Exemplo n.º 2
0
 def setup(self, bottom, top):
     layer_params = yaml.load(self.param_str_)
     self._anchors = generate_anchors()
     self._num_anchors = self._anchors.shape[0]
     self._num_classes = layer_params['num_classes']
     self._bp_all = layer_params.get('bp_all', True)
     self._top_name_map = {}
     top[0].reshape(1, 5)
     self._top_name_map['rois'] = 0
     top[1].reshape(1, 1)
     self._top_name_map['labels'] = 1
     top[2].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_targets'] = 2
     top[3].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_inside_weights'] = 3
     top[4].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_outside_weights'] = 4
     # Add mask-related information
     if cfg.MNC_MODE:
         top[5].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
         self._top_name_map['mask_targets'] = 5
         top[6].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
         self._top_name_map['mask_weight'] = 6
         top[7].reshape(1, 4)
         self._top_name_map['gt_masks_info'] = 7
         if cfg.TRAIN.MIX_INDEX:
             top[8].reshape(1, 4)
             self._top_name_map['fg_inds'] = 8
             top[9].reshape(1, 4)
             self._top_name_map['bg_inds'] = 9
 def setup(self, bottom, top):
     layer_params = yaml.load(self.param_str_)
     self._anchors = generate_anchors()
     self._num_anchors = self._anchors.shape[0]
     self._num_classes = layer_params['num_classes']
     self._bp_all = layer_params.get('bp_all', True)
     self._top_name_map = {}
     top[0].reshape(1, 5)
     self._top_name_map['rois'] = 0
     top[1].reshape(1, 1)
     self._top_name_map['labels'] = 1
     top[2].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_targets'] = 2
     top[3].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_inside_weights'] = 3
     top[4].reshape(1, self._num_classes * 4)
     self._top_name_map['bbox_outside_weights'] = 4
     # Add mask-related information
     if cfg.MNC_MODE:
         top[5].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
         self._top_name_map['mask_targets'] = 5
         top[6].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
         self._top_name_map['mask_weight'] = 6
         top[7].reshape(1, 4)
         self._top_name_map['gt_masks_info'] = 7
         if cfg.TRAIN.MIX_INDEX:
             top[8].reshape(1, 4)
             self._top_name_map['fg_inds'] = 8
             top[9].reshape(1, 4)
             self._top_name_map['bg_inds'] = 9
Exemplo n.º 4
0
 def setup(self, bottom, top):
     layer_params = yaml.load(self.param_str_)
     self._feat_stride = layer_params['feat_stride']
     self._anchors = generate_anchors()
     self._num_anchors = self._anchors.shape[0]
     self._use_clip = layer_params.get('use_clip', 0)
     self._clip_denominator = float(layer_params.get('clip_base', 256))
     self._clip_thresh = 1.0 / self._clip_denominator
     # rois blob: holds R regions of interest, each is a 5-tuple
     # (n, x1, y1, x2, y2) specifying an image batch index n and a
     # rectangle (x1, y1, x2, y2)
     self._top_name_map = {}
     top[0].reshape(1, 5)
     self._top_name_map['rois'] = 0
     # For MNC, we force the output proposals will also be used to train RPN
     # this is achieved by passing proposal_index to anchor_target_layer
     if str(self.phase) == 'TRAIN':
         if cfg.TRAIN.MIX_INDEX:
             top[1].reshape(1, 1)
             self._top_name_map['proposal_index'] = 1
Exemplo n.º 5
0
 def setup(self, bottom, top):
     layer_params = yaml.load(self.param_str_)
     self._anchors = generate_anchors()
     self._num_anchors = self._anchors.shape[0]
     self._num_classes = layer_params['num_classes']
     self._bp_all = layer_params.get('bp_all', True)
     self._top_name_map = {}
     top[0].reshape(1, 5)
     self._top_name_map['rois'] = 0
     top[1].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
     self._top_name_map['mask_targets'] = 1
     top[2].reshape(1, 1, cfg.MASK_SIZE, cfg.MASK_SIZE)
     self._top_name_map['mask_weight'] = 2
     top[3].reshape(1, 4)
     self._top_name_map['gt_masks_info'] = 3
     if cfg.TRAIN.MIX_INDEX:
         top[4].reshape(1, 4)
         self._top_name_map['fg_inds'] = 4
         top[5].reshape(1, 4)
         self._top_name_map['bg_inds'] = 5
Exemplo n.º 6
0
    def setup(self, bottom, top):
        self._anchors = generate_anchors()
        self._num_anchors = self._anchors.shape[0]

        layer_params = yaml.load(self.param_str_)
        self._feat_stride = layer_params['feat_stride']

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = layer_params.get('allowed_border', 0)

        height, width = bottom[0].data.shape[-2:]

        A = self._num_anchors
        # labels
        top[0].reshape(1, 1, A * height, width)
        # bbox_targets
        top[1].reshape(1, A * 4, height, width)
        # bbox_inside_weights
        top[2].reshape(1, A * 4, height, width)
        # bbox_outside_weights
        top[3].reshape(1, A * 4, height, width)
Exemplo n.º 7
0
    def setup(self, bottom, top):
        self._anchors = generate_anchors()
        self._num_anchors = self._anchors.shape[0]

        layer_params = yaml.load(self.param_str_)
        self._feat_stride = layer_params['feat_stride']

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = layer_params.get('allowed_border', 0)

        height, width = bottom[0].data.shape[-2:]

        A = self._num_anchors
        # labels
        top[0].reshape(1, 1, A * height, width)
        # bbox_targets
        top[1].reshape(1, A * 4, height, width)
        # bbox_inside_weights
        top[2].reshape(1, A * 4, height, width)
        # bbox_outside_weights
        top[3].reshape(1, A * 4, height, width)