Skip to main content
QUICK REVIEW

[Paper Review] Spatial-Mamba: Effective Visual State Space Models via Structure-aware State Fusion

Chaodong Xiao, Minghan Li|arXiv (Cornell University)|Oct 19, 2024
Advanced Vision and ImagingComputer Science3 citations
TL;DR

Spatial-Mamba proposes a novel visual state space model that enhances long-range contextual modeling in images by introducing structure-aware state fusion (SASF), which uses dilated convolutions to capture spatial dependencies beyond sequential scanning. With only a single unidirectional scan, it achieves state-of-the-art performance in image classification, detection, and segmentation, outperforming prior SSM-based models while maintaining linear complexity.

ABSTRACT

Selective state space models (SSMs), such as Mamba, highly excel at capturing long-range dependencies in 1D sequential data, while their applications to 2D vision tasks still face challenges. Current visual SSMs often convert images into 1D sequences and employ various scanning patterns to incorporate local spatial dependencies. However, these methods are limited in effectively capturing the complex image spatial structures and the increased computational cost caused by the lengthened scanning paths. To address these limitations, we propose Spatial-Mamba, a novel approach that establishes neighborhood connectivity directly in the state space. Instead of relying solely on sequential state transitions, we introduce a structure-aware state fusion equation, which leverages dilated convolutions to capture image spatial structural dependencies, significantly enhancing the flow of visual contextual information. Spatial-Mamba proceeds in three stages: initial state computation in a unidirectional scan, spatial context acquisition through structure-aware state fusion, and final state computation using the observation equation. Our theoretical analysis shows that Spatial-Mamba unifies the original Mamba and linear attention under the same matrix multiplication framework, providing a deeper understanding of our method. Experimental results demonstrate that Spatial-Mamba, even with a single scan, attains or surpasses the state-of-the-art SSM-based models in image classification, detection and segmentation. Source codes and trained models can be found at https://github.com/EdwardChasel/Spatial-Mamba.

Motivation & Objective

  • To address the limitations of existing visual SSMs that rely on sequential scanning patterns, which distort spatial relationships and limit effective modeling of 2D image structures.
  • To improve the capture of complex spatial dependencies in images by introducing a mechanism that fuses states based on spatial structure rather than sequential order.
  • To unify Mamba and linear attention under a common matrix multiplication framework, providing theoretical insight into visual representation learning.
  • To achieve state-of-the-art performance in vision tasks with minimal computational overhead, using only a single scan and efficient state fusion.

Proposed method

  • The model processes images via a unidirectional sweeping scan to compute initial states, preserving spatial order while enabling efficient computation.
  • A structure-aware state fusion (SASF) module applies dilated convolutions to re-weight and aggregate neighboring states, enabling long-range and non-local spatial context flow.
  • The SASF module uses a learnable neighbor set with dilated convolutions to model spatial structure beyond immediate neighbors, enhancing feature representation.
  • The final output is generated using the standard observation equation, ensuring compatibility with existing SSM frameworks.
  • The method is theoretically unified with Mamba and linear attention under a shared matrix multiplication formulation, revealing deeper connections between these mechanisms.
  • Optimizations such as re-parameterization and CUDA kernel tuning are applied to improve inference speed without sacrificing accuracy.
(d) Structure-aware state fusion with unidirectional scan
(d) Structure-aware state fusion with unidirectional scan

Experimental results

Research questions

  • RQ1Can a state space model effectively capture 2D spatial structures in images without relying on multi-directional scanning?
  • RQ2How can spatial dependencies be modeled more effectively in visual SSMs beyond sequential state transitions?
  • RQ3What is the theoretical relationship between SSMs, Mamba, and linear attention in the context of visual representation learning?
  • RQ4Can a single-scan SSM achieve state-of-the-art performance in vision tasks by incorporating structure-aware state fusion?
  • RQ5How does the design of the neighbor set and fusion mechanism impact model accuracy and efficiency?

Key findings

  • Spatial-Mamba-T achieves a top-1 accuracy of 83.5% on ImageNet-1K, surpassing the baseline by 1.5 percentage points and outperforming NAT-T and VMamba-T.
  • On ADE20K semantic segmentation, Spatial-Mamba-T achieves a multi-scale mIoU of 49.4, which is 1.0 mIoU higher than NAT-T and 0.6 mIoU higher than VMamba-T.
  • Spatial-Mamba-B achieves a multi-scale mIoU of 52.6 on ADE20K, setting a new state-of-the-art for SSM-based models in segmentation.
  • The SASF module with a dilated neighbor set (d=1,3,5) increases top-1 accuracy to 82.7% from 82.0% in the baseline, demonstrating its effectiveness.
  • Re-parameterization and CUDA optimization boost throughput from 1065 to 1438 tokens/ms, improving inference speed by at least 30%.
  • The integration of MESA and LPU further improves accuracy by 0.2% and 0.4% respectively, confirming the benefits of enhanced local modeling and regularization.
(a) SSM in Mamba
(a) SSM in Mamba

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.