napari_cellseg3d.code_models.models.unet.buildingblocks

napari_cellseg3d.code_models.models.unet.buildingblocks#

Functions

conv3d(in_channels, out_channels, ...)

create_conv(in_channels, out_channels, ...)

Create a list of modules with together constitute a single conv layer with non-linearity and optional batchnorm/groupnorm.

create_decoders(f_maps, basic_module, ...)

create_encoders(in_channels, f_maps, ...)

Classes

AbstractUpsampling(upsample)

Abstract class for upsampling.

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

A single module for decoder path consisting of the upsampling layer (either learned ConvTranspose3d or nearest neighbor interpolation) followed by a basic module (DoubleConv or ExtResNetBlock).

DoubleConv(in_channels, out_channels, encoder)

A module consisting of two consecutive convolution layers (e.g. BatchNorm3d+ReLU+Conv3d).

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

A single module from the encoder path consisting of the optional max pooling layer (one may specify the MaxPool kernel_size to be different than the standard (2,2,2), e.g. if the volumetric data is anisotropic (make sure to use complementary scale_factor in the decoder path) followed by a DoubleConv module.

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

Basic UNet block consisting of a SingleConv followed by the residual block.

InterpolateUpsampling([mode])

Args: mode (str): algorithm used for upsampling: 'nearest' | 'linear' | 'bilinear' | 'trilinear' | 'area'. Default: 'nearest' used only if transposed_conv is False.

NoUpsampling()

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

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

Basic convolutional module consisting of a Conv3d, non-linearity and optional batchnorm/groupnorm.

TransposeConvUpsampling([in_channels, ...])

Args: in_channels (int): number of input channels for transposed conv used only if transposed_conv is True out_channels (int): number of output channels for transpose conv used only if transposed_conv is True kernel_size (int or tuple): size of the convolving kernel used only if transposed_conv is True scale_factor (int or tuple): stride of the convolution used only if transposed_conv is True.