FastSurferCNN.models.networks

class FastSurferCNN.models.networks.FastSurferCNN(params, padded_size)[source]

Main Fastsurfer CNN Network.

Attributes

classifier

Initialized Classification Block.

Methods

forward(x[, scale_factor, scale_factor_out])

Feedforward through graph.

forward(x, scale_factor=None, scale_factor_out=None)[source]

Feedforward through graph.

Parameters:
xTensor

Input image [N, C, H, W].

scale_factorTensor, optional

[N, 1] Defaults to None.

scale_factor_outTensor, optional

Tensor representing the scale factor for the output. Defaults to None.

Returns:
outputTensor

Prediction logits.

class FastSurferCNN.models.networks.FastSurferCNNBase(params, padded_size=256)[source]

Network Definition of Fully Competitive Network network.

  • Spatial view aggregation (input 7 slices of which only middle one gets segmented)

  • Same Number of filters per layer (normally 64)

  • Dense Connections in blocks

  • Unpooling instead of transpose convolutions

  • Concatenationes are replaced with Maxout (competitive dense blocks)

  • Global skip connections are fused by Maxout (global competition)

  • Loss Function (weighted Cross-Entropy and dice loss)

Attributes

encode1, encode2, encode3, encode4

Competitive Encoder Blocks.

decode1, decode2, decode3, decode4

Competitive Decoder Blocks.

bottleneck

Bottleneck Block.

Methods

forward(x[, scale_factor, scale_factor_out])

Feedforward through graph.

forward(x, scale_factor=None, scale_factor_out=None)[source]

Feedforward through graph.

Parameters:
xTensor

Input image [N, C, H, W] representing the input data.

scale_factorTensor, optional

[N, 1] Defaults to None.

scale_factor_outTensor, optional

Tensor representing the scale factor for the output. Defaults to None.

Returns:
decoder_output1Tensor

Prediction logits.

class FastSurferCNN.models.networks.FastSurferVINN(params, padded_size=256)[source]

Network Definition of Fully Competitive Network.

  • Spatial view aggregation (input 7 slices of which only middle one gets segmented)

  • Same Number of filters per layer (normally 64)

  • Dense Connections in blocks

  • Unpooling instead of transpose convolutions

  • Concatenationes are replaced with Maxout (competitive dense blocks)

  • Global skip connections are fused by Maxout (global competition)

  • Loss Function (weighted Cross-Entropy and dice loss)

Attributes

height

The height of segmentation model (after interpolation layer).

width

The width of segmentation model.

out_tensor_shape

Out tensor dimensions for interpolation layer.

interpolation_mode

Interpolation mode for up/downsampling in flex networks.

crop_position

Crop positions for up/downsampling in flex networks.

inp_block

Initialized input dense block.

outp_block

Initialized output dense block.

interpol1

Initialized 2d input interpolation block.

interpol2

Initialized 2d output interpolation block.

classifier

Initialized Classification Block.

Methods

forward(x, scale_factor[, scale_factor_out])

Feedforward through graph.

forward(x, scale_factor, scale_factor_out=None)[source]

Feedforward through graph.

Parameters:
xTensor

Input image [N, C, H, W].

scale_factorTensor

Tensor of shape [N, 1] representing the scale factor for each image in the batch.

scale_factor_outTensor, optional

Tensor representing the scale factor for the output. Defaults to None.

Returns:
logitsTensor

Prediction logits.

FastSurferCNN.models.networks.build_model(cfg)[source]

Build requested model.

Parameters:
cfgyacs.config.CfgNode

Node of configs to be used.

Returns:
model

Object of the initialized model.