vis4d.op.base.base

Base model interface.

Classes

BaseModel(*args, **kwargs)

Abstract base model for feature extraction.

class BaseModel(*args, **kwargs)[source]

Abstract base model for feature extraction.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

__call__(images)[source]

Type definition for call implementation.

Parameters:

images (torch.Tensor) – Image input to process.

Returns:

The output feature pyramid.

Return type:

list[torch.Tensor]

abstract forward(images)[source]

Base model forward.

Parameters:

images (Tensor[N, C, H, W]) – Image input to process. Expected to be type float32.

Raises:

NotImplementedError – This is an abstract class method.

Returns:

The output feature pyramid. The list index represents the level, which has a downsampling ratio of 2^index for most of the cases. fp[2] is the C2 or P2 in the FPN paper (https://arxiv.org/abs/1612.03144). fp[0] is the original image or the feature map with the same resolution. fp[1] may be the copy of the input image if the network doesn’t generate the feature map of the resolution.

Return type:

fp (list[torch.Tensor])

abstract property out_channels: list[int]

Get the number of channels for each level of feature pyramid.

Raises:

NotImplementedError – This is an abstract class method.

Returns:

Number of channels.

Return type:

list[int]