vis4d.op.box.poolers.utils

Utility functions for RoI poolers.

Functions

assign_boxes_to_levels(box_lists, min_level, ...)

Map each box to a feature map level index and return the assignment.

boxes_to_tensor(boxes)

Convert all boxes into the tensor format used by ROI pooling ops.

assign_boxes_to_levels(box_lists, min_level, max_level, canonical_box_size, canonical_level)[source]

Map each box to a feature map level index and return the assignment.

Parameters:
  • box_lists (list[Tensor]) – List of Boxes

  • min_level (int) – Smallest feature map level index. The input is considered index 0, the output of stage 1 is index 1, and so.

  • max_level (int) – Largest feature map level index.

  • canonical_box_size (int) – A canonical box size in pixels (sqrt(box area)).

  • canonical_level (int) – The feature map level index on which a canonically-sized box should be placed.

Return type:

Tensor

Returns:

Tensor (M,), where M is the total number of boxes in the list. Each element is the feature map index, as an offset from min_level, for the corresponding box (so value i means the box is at self.min_level + i).

boxes_to_tensor(boxes)[source]

Convert all boxes into the tensor format used by ROI pooling ops.

Parameters:

boxes (list[Tensor]) – List of Boxes

Return type:

Tensor

Returns:

A tensor of shape (M, 5), where M is the total number of boxes aggregated over all N batch images. The 5 columns are (batch index, x0, y0, x1, y1), where batch index is in [0, N).