fusionlab.segmentation.base module#

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

Bases: Module

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.

training: bool#
class fusionlab.segmentation.base.SegmentationModel(*args, **kwargs)[source]#

Bases: Module

Base PyTorch class of the segmentation model with Encoder, Bridger, Decoder, Head

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#