fusionlab.segmentation.segformer.segformer module#

class fusionlab.segmentation.segformer.segformer.ConvModule(c1, c2)[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.

Return type:

Tensor

training: bool#
class fusionlab.segmentation.segformer.segformer.MLP(dim, embed_dim)[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.

Return type:

Tensor

training: bool#
class fusionlab.segmentation.segformer.segformer.SegFormer(num_classes=6, mit_encoder_type='B0')[source]#

Bases: Module

SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers<https://arxiv.org/abs/2105.15203>

source code: sithu31296/semantic-segmentation

Parameters:
  • num_classes (int) – number of classes to segment

  • mit_encoder_type (str) – type of MiT encoder, one of [‘B0’, ‘B1’, ‘B2’, ‘B3’, ‘B4’, ‘B5’]

forward(inputs)[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.

Return type:

Tensor

training: bool#
class fusionlab.segmentation.segformer.segformer.SegFormerHead(dims, embed_dim=256, num_classes=19)[source]#

Bases: Module

forward(features)[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.

Return type:

Tensor

training: bool#