glasses.models.segmentation.base package¶
Module contents¶
- class glasses.models.segmentation.base.SegmentationModule(in_channels: int, n_classes: int, encoder: torch.nn.modules.module.Module, decoder: torch.nn.modules.module.Module, **kwargs)[source]¶
Bases:
glasses.models.base.VisionModule
Base Segmentation Module class
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: torch.Tensor) torch.Tensor [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.
- abstract classmethod from_encoder(model: torch.nn.modules.module.Module, *args, **kwargs) torch.nn.modules.module.Module [source]¶
Extract the decoder part from a given model.
- Parameters
name (str) – A function returning a model
- Returns
- Return type
[nn.Module] A PyTorch module
- training: bool¶