Example #1
0
 def __call__(self,
              rpn_rois,
              rpn_rois_num,
              gt_classes,
              is_crowd,
              gt_boxes,
              im_info,
              stage=0,
              max_overlap=None):
     rpn_rois = rpn_rois.numpy()
     rpn_rois_num = rpn_rois_num.numpy()
     gt_classes = gt_classes.numpy()
     gt_boxes = gt_boxes.numpy()
     is_crowd = is_crowd.numpy()
     im_info = im_info.numpy()
     max_overlap = max_overlap if max_overlap is None else max_overlap.numpy(
     )
     reg_weights = [i / (stage + 1) for i in self.bbox_reg_weights]
     is_cascade = True if stage > 0 else False
     num_classes = 2 if is_cascade else self.num_classes
     outs = generate_proposal_target(
         rpn_rois, rpn_rois_num, gt_classes, is_crowd, gt_boxes, im_info,
         self.batch_size_per_im, self.fg_fraction, self.fg_thresh[stage],
         self.bg_thresh_hi[stage], self.bg_thresh_lo[stage], reg_weights,
         num_classes, self.use_random, self.is_cls_agnostic, is_cascade,
         max_overlap)
     outs = [to_tensor(v) for v in outs]
     for v in outs:
         v.stop_gradient = True
     return outs
Example #2
0
 def __call__(self,
              rpn_rois,
              rpn_rois_num,
              gt_classes,
              is_crowd,
              gt_boxes,
              im_info,
              stage=0):
     rpn_rois = rpn_rois.numpy()
     rpn_rois_num = rpn_rois_num.numpy()
     gt_classes = gt_classes.numpy()
     gt_boxes = gt_boxes.numpy()
     is_crowd = is_crowd.numpy()
     im_info = im_info.numpy()
     outs = generate_proposal_target(
         rpn_rois, rpn_rois_num, gt_classes, is_crowd, gt_boxes, im_info,
         self.batch_size_per_im, self.fg_fraction, self.fg_thresh[stage],
         self.bg_thresh_hi[stage], self.bg_thresh_lo[stage],
         self.bbox_reg_weights[stage], self.num_classes, self.use_random,
         self.is_cls_agnostic, self.is_cascade_rcnn)
     outs = [to_tensor(v) for v in outs]
     for v in outs:
         v.stop_gradient = True
     return outs