Abstract
Domain Generalized Semantic Segmentation (DGSS) remains a critical challenge for deploying autonomous systems in diverse environments. While Vision Transformers (ViTs) offer global context, their quadratic complexity is often prohibitive. State Space Models (SSMs) like Mamba provide linear complexity with global receptive fields but suffer from "non-causal token" interference when 2D images are flattened into 1D sequences. This paper introduces MaskViM, a novel architecture featuring a learnable masking mechanism that filters irrelevant historical context. MaskViM achieves state-of-the-art performance on major DGSS benchmarks while maintaining significantly lower computational costs than Transformer-based counterparts.
Introduction
Semantic segmentation models often experience significant performance degradation when encountering out-of-distribution data, such as varying weather conditions or geographic locations. This problem, known as Domain Generalized Semantic Segmentation (DGSS), has traditionally been addressed using Convolutional Neural Networks (CNNs) or Vision Transformers (ViTs). CNNs are efficient but constrained by local receptive fields, whereas ViTs capture global context at the cost of high computational complexity.
State Space Models (SSMs), particularly the Mamba architecture, have emerged as a promising alternative, offering global receptive fields with linear complexity. However, applying 1D SSMs to 2D images requires flattening the image into a sequence. This process introduces "non-causal tokens"—pixels that are spatially distant but adjacent in the sequence—which can mislead the model by providing irrelevant context from the sequence's history.
Methods
To address the non-causal token problem, the authors propose the Masked Vision State Space (MVSS) block. The core of this block is a learnable binary masking mechanism designed to preserve semantic integrity.
Learnable Binary Masking
Rather than using a static scanning pattern, MaskViM learns a mask for every token. This mask selectively filters out tokens that would disrupt the semantic integrity of the sequence. To ensure the mechanism is differentiable, the authors employ the Gumbel-Softmax trick, allowing the discrete masking operation to be optimized via standard backpropagation.
Dual-Component Mask Loss
The training process is guided by a specialized loss function ($L_m$) consisting of two parts:
- Ratio Loss ($L_m^r$): Regulates the proportion of the image that is masked to prevent over-masking or under-masking.
- Position Loss ($L_m^p$): Aligns the mask with actual semantic boundaries by comparing intermediate predictions with ground truth labels.
Key Results
MaskViM was evaluated on rigorous benchmarks, including Cityscapes, GTAV, BDD100K, and Mapillary, focusing on the model's ability to generalize to unseen domains.
Accuracy and Generalization
MaskViM demonstrated superior generalization capabilities, achieving a +1.9% mIoU improvement over the previous state-of-the-art (HGFormer) in the Cityscapes-to-others benchmark. In synthetic-to-real tasks (GTAV-to-others), it outperformed BlindNet by +1.7% mIoU.
Efficiency and Robustness
The model offers significant efficiency gains. Compared to UperNet with a Swin-T backbone, MaskViM-T requires 3x fewer FLOPs (305G vs 945G) while delivering a substantially higher mIoU (56.4% vs 47.1%). Furthermore, MaskViM exhibits high resilience to digital corruptions, such as JPEG artifacts, outperforming existing models by over 15% mIoU in corrupted data scenarios.
Discussion and Insights
The effectiveness of MaskViM stems from its ability to solve the "History Problem" inherent in SSMs. In a standard SSM, the current output is heavily influenced by the hidden state of all preceding tokens. By masking unrelated "history" in the 1D sequence, MaskViM ensures that the model relies on semantically relevant visual context.
The authors observed that masking is most beneficial in the shallower layers of the network. In deeper stages (e.g., Stage 4), where feature maps are low-resolution and semantically dense, masking can lead to a significant loss of information, suggesting that selective attention strategies must be carefully tuned to the resolution of the feature map.
Conclusion
MaskViM represents a significant step forward in efficient and robust semantic segmentation. By integrating learnable masking into State Space Models, it overcomes the structural limitations of 1D sequence processing for 2D vision tasks, providing a scalable and high-performance solution for domain generalized applications.
Summary updated