8.1.1.9.2.1. blueoil.utils.box

8.1.1.9.2.1.1. Module Contents

8.1.1.9.2.1.1.1. Functions

iou(boxes, box)

Calculate overlap

fill_dummy_boxes(gt_boxes, num_max_boxes)

crop_boxes(boxes, crop_rect)

Crop boxes

format_cxcywh_to_xywh(boxes, axis=1)

Format form (center_x, center_y, w, h) to (x, y, w, h) along specific dimension.

blueoil.utils.box.iou(boxes, box)

Calculate overlap

Parameters
  • boxes – boxes in the image. shape is [num_boxes, 4 or more(x, y, w, h, …)]

  • box – a single box in the image. shape is [4 or more (x, y, w, h, …)]

Returns

shape is [num_boxes]

Return type

iou

blueoil.utils.box.fill_dummy_boxes(gt_boxes, num_max_boxes)
blueoil.utils.box.crop_boxes(boxes, crop_rect)

Crop boxes

Parameters
  • boxes – ground truth boxes in the image. shape is [num_boxes, 5(x, y, w, h, class)]

  • crop_rect – a crop rectangle. shape is [4(x, y, w, h)]

Returns

shape is [num_boxes, 5(x, y, w, h, class)]

Return type

cropped_boxes

blueoil.utils.box.format_cxcywh_to_xywh(boxes, axis=1)

Format form (center_x, center_y, w, h) to (x, y, w, h) along specific dimension.

Args: boxes: A tensor include boxes. [:, 4(x, y, w, h)] axis: Which dimension of the inputs Tensor is boxes.