fusionlab.segmentation.unet.unet module#

class fusionlab.segmentation.unet.unet.BasicBlock(cin, cout, spatial_dims=2)[source]#

Bases: Sequential

class fusionlab.segmentation.unet.unet.Bridger[source]#

Bases: Module

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class fusionlab.segmentation.unet.unet.Decoder(cin, base_dim, spatial_dims=2)[source]#

Bases: Module

__init__(cin, base_dim, spatial_dims=2)[source]#

Base UNet decoder :param cin: input channels :type cin: int :param base_dim: output dim of deepest stage output :type base_dim: int

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class fusionlab.segmentation.unet.unet.DecoderBlock(c1, c2, cout, spatial_dims=2)[source]#

Bases: Module

__init__(c1, c2, cout, spatial_dims=2)[source]#

Base Unet decoder block for merging the outputs from 2 stages :param c1: input dim of the deeper stage :param c2: input dim of the shallower stage :param cout: output dim of the block

forward(x1, x2)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class fusionlab.segmentation.unet.unet.Encoder(cin, base_dim, spatial_dims=2)[source]#

Bases: Module

__init__(cin, base_dim, spatial_dims=2)[source]#

UNet Encoder :param cin: input channels :type cin: int :param base_dim: 1st stage dim of conv output :type base_dim: int

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class fusionlab.segmentation.unet.unet.Head(cin, cout, spatial_dims=2)[source]#

Bases: Sequential

__init__(cin, cout, spatial_dims=2)[source]#

Basic conv head :param int cin: input channel :param int cout: output channel

class fusionlab.segmentation.unet.unet.UNet(cin, num_cls, base_dim=64, spatial_dims=2)[source]#

Bases: SegmentationModel

__init__(cin, num_cls, base_dim=64, spatial_dims=2)[source]#

Base Unet :param cin: input channels :type cin: int :param num_cls: number of classes :type num_cls: int :param base_dim: 1st stage dim of conv output :type base_dim: int

training: bool#