Ejemplo n.º 1
0
 def __call__(self, gt_boxes, gt_labels):
     if type(gt_boxes) is np.ndarray:
         gt_boxes = torch.from_numpy(gt_boxes)
     if type(gt_labels) is np.ndarray:
         gt_labels = torch.from_numpy(gt_labels)
     boxes, labels = box_utils.assign_priors(gt_boxes, gt_labels,
                                             self.corner_form_priors, self.iou_threshold)
     boxes = box_utils.corner_form_to_center_form(boxes)
     locations = box_utils.convert_boxes_to_locations(boxes, self.center_form_priors, self.center_variance, self.size_variance)
     return locations, labels
Ejemplo n.º 2
0
    def __call__(self, gt_boxes, gt_labels):
        if type(gt_boxes) is np.ndarray:
            gt_boxes = torch.from_numpy(gt_boxes)
        if type(gt_labels) is np.ndarray:
            gt_labels = torch.from_numpy(gt_labels)

        if (gt_boxes.shape[0] == 0):
            raise ValueError("Error in ground truth box size: " +
                             str(gt_boxes.shape))

        boxes, labels = box_utils.assign_priors(gt_boxes, gt_labels,
                                                self.corner_form_priors,
                                                self.iou_threshold)
        boxes = box_utils.corner_form_to_center_form(boxes)
        locations = box_utils.convert_boxes_to_locations(
            boxes, self.center_form_priors, self.center_variance,
            self.size_variance)
        return locations, labels