Skip to content
fn

mask2former_swin_tiny

→Mask2FormerForSemanticSegmentation
mask2former_swin_tiny(pretrained: bool | str = False, weights: Mask2FormerSwinTinyWeights | None = None, overrides: object = {})

Mask2Former with Swin-Tiny backbone (Cheng et al., CVPR 2022).

Builds a Mask2FormerForSemanticSegmentation with the Swin-Tiny backbone (embed_dim = 96, depths = (2, 2, 6, 2), num_heads = (3, 6, 12, 24), window_size = 7), a 6-layer multi-scale deformable pixel decoder, and a 9-layer masked-attention transformer decoder with 100 queries. Default targets ADE20K (150 classes); reaches ADE20K validation mIoU of 47.7%.

Model Size

Parameters

pretrainedbool or str= False
Pretrained-weight selector. False → random init; True → the DEFAULT tag (Mask2FormerSwinTinyWeights.ADE20K); a tag string → that specific checkpoint. Mutually exclusive with weights (which wins if both are given).
weights(Mask2FormerSwinTinyWeights, optional, keyword - only)= None
Explicit weights enum member. Takes precedence over pretrained.
**overridesobject= {}
Keyword overrides forwarded into Mask2FormerConfig.

Returns

Mask2FormerForSemanticSegmentation

Segmentation model with the Mask2Former-Swin-T configuration applied (or with overrides merged on top of it).

Examples

>>> import lucid
>>> from lucid.models.vision.mask2former import mask2former_swin_tiny
>>> model = mask2former_swin_tiny()
>>> x = lucid.randn(1, 3, 384, 384)
>>> out = model(x)
>>> out.logits.shape[1]
150

Used by 1