Esempio n. 1
0
 def get_target(self, sampling_results, gt_masks, gt_labels,
                rcnn_train_cfg):
     """
     obb target hbb
     :param sampling_results:
     :param gt_masks:
     :param gt_labels:
     :param rcnn_train_cfg:
     :param mod: 'normal' or 'best_match', 'best_match' is used for RoI Transformer
     :return:
     """
     pos_proposals = [res.pos_bboxes for res in sampling_results]
     neg_proposals = [res.neg_bboxes for res in sampling_results]
     # pos_gt_bboxes = [res.pos_gt_bboxes for res in sampling_results]
     # TODO: first get indexs of pos_gt_bboxes, then index from gt_bboxes
     # TODO: refactor it, direct use the gt_rbboxes instead of gt_masks
     pos_assigned_gt_inds = [
         res.pos_assigned_gt_inds for res in sampling_results
     ]
     pos_gt_labels = [res.pos_gt_labels for res in sampling_results]
     reg_classes = 1 if self.reg_class_agnostic else self.num_classes
     cls_reg_targets = bbox_target_rbbox(pos_proposals,
                                         neg_proposals,
                                         pos_assigned_gt_inds,
                                         gt_masks,
                                         pos_gt_labels,
                                         rcnn_train_cfg,
                                         reg_classes,
                                         target_means=self.target_means,
                                         target_stds=self.target_stds,
                                         with_module=self.with_module,
                                         hbb_trans=self.hbb_trans)
     return cls_reg_targets
Esempio n. 2
0
    def get_target_hbbox2rbbox(self, sampling_results, gt_rbboxes_poly, cfg):
        pos_proposals = [res.pos_bboxes for res in sampling_results]
        neg_proposals = [res.neg_bboxes for res in sampling_results]
        # pos_gt_bboxes = [res.pos_gt_bboxes for res in sampling_results]
        pos_assigned_gt_inds = [
            res.pos_assigned_gt_inds for res in sampling_results
        ]

        pos_gt_labels = [res.pos_gt_labels for res in sampling_results]
        reg_classes = 1 if self.reg_class_agnostic else self.num_classes
        cls_reg_targets = bbox_target_rbbox(pos_proposals,
                                            neg_proposals,
                                            pos_gt_labels,
                                            pos_assigned_gt_inds,
                                            gt_rbboxes_poly,
                                            cfg,
                                            reg_classes,
                                            target_means=self.target_means,
                                            target_stds=self.target_stds)

        # print(bbox_targets)
        return cls_reg_targets