Segmentation Model#

UNet#

class fusionlab.segmentation.UNet(cin, num_cls, base_dim=64, spatial_dims=2)[source]#
__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

class fusionlab.segmentation.TFUNet(*args, **kwargs)[source]#
__init__(num_cls, base_dim=64)[source]#

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

ResUNet#

class fusionlab.segmentation.ResUNet(cin, num_cls, base_dim, spatial_dims=2)[source]#
class fusionlab.segmentation.TFResUNet(*args, **kwargs)[source]#

UNet++#

class fusionlab.segmentation.UNet2plus(cin, num_cls, base_dim, spatial_dims=2)[source]#
class fusionlab.segmentation.TFUNet2plus(*args, **kwargs)[source]#

HuggingFace Segmentation Model#

class fusionlab.segmentation.HFSegmentationModel(model, num_cls=None, loss_fct=CrossEntropyLoss())[source]#

Base Hugginface-pytoch model wrapper class of the segmentation model

forward(x, labels=None)[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.