utils.roi.RoI

Contents

utils.roi.RoI#

class RoI(iou_threshold=0.5)[source]#

Bases: object

Label anchor boxes using ground-truth bounding boxes

Parameters:

iou_threshold (float, optional) – Minimum acceptable iou. Defaults to 0.5.

Methods

__call__(anchors: Tensor, labels: Tensor) tuple[Tensor, Tensor, Tensor][source]#

Label anchor boxes using ground-truth bounding boxes

Parameters:
  • anchors (torch.Tensor) – Shape [anchor, 4]

  • labels (torch.Tensor) –

    Shape [batch, gt_boxes, 5]

    One label contains (class, luw, luh, rdw, rdh)

Returns:

List of 3 tensors:

  1. Ground truth offsets for each box. Shape [batch, anchor, 4].

  2. Box mask. Shape [batch, anchor, 4]. (0)*4 for background, (1)*4 for object.

  3. Class of each box (0 - background). Shape [batch, anchor].

Return type:

tuple[torch.Tensor, torch.Tensor, torch.Tensor]