vis4d.op.fpp.fpn

Feature Pyramid Network.

This is based on “Feature Pyramid Network for Object Detection”.

Classes

ExtraFPNBlock(extra_levels, in_channels, ...)

Extra block in the FPN.

FPN(in_channels_list, out_channels[, ...])

Feature Pyramid Network.

class ExtraFPNBlock(extra_levels, in_channels, out_channels, add_extra_convs='on_output', extra_relu=False)[source]

Extra block in the FPN.

This is a wrapper of the torchvision implementation.

Create an instance of the class.

forward(results, x, names)[source]

Forward.

Return type:

tuple[list[Tensor], list[str]]

class FPN(in_channels_list, out_channels, extra_blocks=LastLevelMaxPool(), start_index=2)[source]

Feature Pyramid Network.

This is a wrapper of the torchvision implementation.

Init without additional components.

Parameters:
  • in_channels_list (list[int]) – List of input channels.

  • out_channels (int) – Output channels.

  • extra_blocks (_ExtraFPNBlock, optional) – Extra block. Defaults to LastLevelMaxPool().

  • start_index (int, optional) – Start index of base model feature maps. Defaults to 2.

__call__(x)[source]

Type definition for call implementation.

Return type:

list[Tensor]

forward(x)[source]

Process the input features with FPN.

Because by default, FPN doesn’t upsample the first two feature maps in the pyramid, we keep the first two feature maps intact.

Parameters:
  • x (list[Tensor]) – Feature pyramid as outputs of the

  • model. (base)

Returns:

Feature pyramid after FPN processing.

Return type:

list[Tensor]