utils.anchors.AnchorGenerator

utils.anchors.AnchorGenerator#

class AnchorGenerator(sizes: Tensor, ratios: Tensor, step: int = 1)[source]#

Bases: Module

Extracts multiple region proposals on the input image

Parameters:
  • sizes (torch.Tensor) – Box scales (0,1] = S’/S.

  • ratios (torch.Tensor) – Ratio of width to height of boxes (w/h).

  • step (int, optional) – Box per pixel. Defaults to 1.

Methods

Attributes

training

__call__(X: Tensor) Tensor[source]#

Generate anchor boxes with different shapes centered on each pixel.

Parameters:

X (torch.Tensor) – Feature map.

Returns:

Tensor with hypotheses.

Shape: [anchor, 4].

Data: (xlu, ylu, xrd, yrd).

Return type:

torch.Tensor