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 True or (gt_boxes.shape[-1]) == 3:
            gt_boxes = box_utils.corner_form_to_center_form(gt_boxes)
            gt_boxes[..., 2] += gt_boxes[..., 3]
            gt_boxes = torch.narrow(gt_boxes, 1, 0, 3)
            gt_boxes[..., 2] *= 0.5 * (
                4 / 3.14)  # scale up the circles to have same areas as squares
        # gt_boxes = box_utils.corner_form_to_center_form(gt_boxes)
        # gt_boxes[..., 2] += gt_boxes[..., 3]
        # gt_boxes = torch.narrow(gt_boxes, 2, 0, 3)
        # gt_boxes[..., 2] *= 0.5 * (4 / 3.14)    # scale up the circles to have same areas as squares

        boxes, labels = box_utils.assign_priors(gt_boxes, gt_labels,
                                                self.center_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
Esempio 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)
     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
Esempio n. 3
0
	def __call__(self, gt_boxes, gt_labels):
		"""
		Arguments:
			gt_boxes : ground truth boxes
			gt_labels : ground truth labels
		Returns:
			locations of form (batch_size, num_priors, 4) and 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