vis4d.op.seg.fcn

FCN Head for semantic segmentation.

Classes

FCNHead(in_channels, out_channels[, ...])

FCN Head made with ResNet base model.

FCNOut(pred, outputs)

Output of the FCN prediction.

class FCNHead(in_channels, out_channels, dropout_prob=0.1, resize=None)[source]

FCN Head made with ResNet base model.

This is based on the implementation in torchvision.

Creates an instance of the class.

Parameters:
  • in_channels (list[int]) – Number of channels in multi-level image feature.

  • out_channels (int) – Number of output channels. Usually the number of classes.

  • dropout_prob (float, optional) – Dropout probability. Defaults to 0.1.

  • resize (tuple(int,int), optional) – Target shape to resize output. Defaults to None.

__call__(feats)[source]

Type definition for function call.

Return type:

FCNOut

forward(feats)[source]

Transforms feature maps and returns segmentation prediction.

Parameters:

feats (list[torch.Tensor]) – List of multi-level image features.

Returns:

Each tensor has shape (batch_size, self.channels, H, W) which is prediction for each FCN stages. E.g.,

outputs[-1] ==> main output map outputs[-2] ==> aux output map (e.g., used for training) outputs[:-2] ==> x[:-2]

Return type:

output (list[torch.Tensor])

class FCNOut(pred: torch.Tensor, outputs: list[torch.Tensor])[source]

Output of the FCN prediction.

Create new instance of FCNOut(pred, outputs)

outputs: list[Tensor]

Alias for field number 1

pred: Tensor

Alias for field number 0