Skip to content
fn

mask2former_swin_base

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

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

Builds a Mask2FormerForSemanticSegmentation with the Swin-Base backbone (embed_dim = 128, depths = (2, 2, 18, 2), num_heads = (4, 8, 16, 32)). ADE20K validation mIoU of 53.9%.

Model Size

Parameters

pretrainedbool or str= False
Pretrained-weight selector. False → random init; True → the DEFAULT tag; a tag string → that specific checkpoint.
weights(Mask2FormerSwinBaseWeights, 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-B configuration applied (or with overrides merged on top of it).

Examples

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

Used by 1