class DecodingBlock[source]

DecodingBlock(in_channels_skip_connection:int, dimensions:int, upsampling_type:str, normalization:str, preactivation:bool, residual:bool=False, use_padding:bool=False, padding_mode:str='zeros', activation:str='ReLU', dilation:int=None, dropout:float=0.0, upsample_recover_orig_size:bool=False) :: Module

This class defines a decoding block for the decoder.

Type Default Details
in_channels_skip_connection int The number of input channels from the skip connections of the encoder.
dimensions int The number of dimensions to consider. Possible options are 2 and 3.
upsampling_type str The type of upsampling to use.
normalization str The type of normalization to use. Possible options include "batch", "layer" and "instance".
preactivation bool Whether to use preactivations.
residual bool False Whether the decoder should be a residual network.
use_padding bool False Whether to use padding.
padding_mode str zeros The type of padding to use.
activation str ReLU The activation function that should be used.
dilation int None The amount of dilation that should be used.
dropout float 0.0 The dropout rate.
upsample_recover_orig_size bool False Whether the original input size of the encoder should be recovered with the decoder output.

DecodingBlock.forward[source]

DecodingBlock.forward(skip_connection:list, x:Tensor)

The forward pass of the decoding block.

Type Default Details
skip_connection list A list of torch.Tensors that contain the outputs of the skip connections from an encoding block.
x Tensor The input to the decoding block.

class Decoder[source]

Decoder(in_channels_skip_connection:int, dimensions:int, upsampling_type:str, num_decoding_blocks:int, normalization:str, preactivation:bool, residual:bool=False, use_padding:bool=False, padding_mode:str='zeros', activation:str='ReLU', initial_dilation:int=None, dropout:float=0.0, upsample_recover_orig_size:bool=False) :: Module

Defines a decoder that can be used for the construction of UNets [1]. The decoder is a neural network that takes the feature vector from the encoder and decodes it into an output.

Type Default Details
in_channels_skip_connection int The number of input channels from the skip connections of the encoder.
dimensions int The number of dimensions to consider. Possible options are 2 and 3.
upsampling_type str The type of upsampling to use.
num_decoding_blocks int The number of decoding blocks.
normalization str The type of normalization to use. Possible options include "batch", "layer" and "instance".
preactivation bool Whether to use preactivations.
residual bool False Whether the decoder should be a residual network.
use_padding bool False Whether to use padding.
padding_mode str zeros The type of padding to use.
activation str ReLU The activation function that should be used.
initial_dilation int None The amount of dilation that should be used in the first encoding block.
dropout float 0.0 The dropout rate.
upsample_recover_orig_size bool False Whether the original input size of the encoder should be recovered with the decoder output.

Decoder.forward[source]

Decoder.forward(skip_connections:list, x:Tensor)

The forward pass of the decoder.

Type Default Details
skip_connections list A list of torch.Tensors that contain the outputs of the skip connections from an encoder.
x Tensor The input to the decoder.

References

[1] Falk, Thorsten, et al. "U-Net: deep learning for cell counting, detection, and morphometry." Nature methods 16.1 (2019): 67-70.