[论文解读] Spatial-Mamba: Effective Visual State Space Models via Structure-aware State Fusion
Spatial-Mamba 提出了一种新颖的视觉状态空间模型,通过引入结构感知状态融合(SASF),增强了图像中长距离上下文建模能力。该方法利用空洞卷积捕捉超越顺序扫描的时空依赖关系。仅通过单向扫描,它在图像分类、检测和分割任务中均实现了最先进性能,优于以往基于 SSM 的模型,同时保持线性复杂度。
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.
研究动机与目标
- 为解决现有视觉 SSM 依赖顺序扫描模式所带来的局限性,此类模式会扭曲空间关系并限制对二维图像结构的有效建模。
- 通过引入基于空间结构而非顺序顺序的状态融合机制,提升对图像中复杂空间依赖关系的捕捉能力。
- 在统一的矩阵乘法框架下统一 Mamba 与线性注意力,为视觉表征学习提供理论洞见。
- 在仅使用单次扫描和高效状态融合的前提下,实现视觉任务中的最先进性能,同时计算开销最小化。
提出的方法
- 该模型通过单向扫面处理图像,以计算初始状态,既保留空间顺序,又实现高效计算。
- 结构感知状态融合(SASF)模块应用空洞卷积对邻近状态进行重新加权和聚合,实现长距离和非局部的空间上下文流动。
- SASF 模块使用可学习的邻域集合结合空洞卷积,建模超越邻近邻居的空间结构,增强特征表示能力。
- 最终输出通过标准观测方程生成,确保与现有 SSM 框架的兼容性。
- 该方法在共享矩阵乘法公式下与 Mamba 和线性注意力在理论上统一,揭示了这些机制之间的深层联系。
- 通过重参数ization 和 CUDA 内核调优等优化手段,提升推理速度而不损失精度。

实验结果
研究问题
- RQ1在不依赖多方向扫描的前提下,状态空间模型能否有效捕捉图像中的二维空间结构?
- RQ2在视觉 SSM 中,如何超越顺序状态转移,更有效地建模空间依赖关系?
- RQ3在视觉表征学习背景下,SSM、Mamba 和线性注意力之间的理论关系是什么?
- RQ4通过引入结构感知状态融合,单次扫描的 SSM 能否在视觉任务中实现最先进性能?
- RQ5邻域集合与融合机制的设计如何影响模型的准确率与效率?
主要发现
- Spatial-Mamba-T 在 ImageNet-1K 上达到 83.5% 的 top-1 准确率,较基线提升 1.5 个百分点,优于 NAT-T 和 VMamba-T。
- 在 ADE20K 语义分割任务中,Spatial-Mamba-T 实现多尺度 mIoU 为 49.4,较 NAT-T 高出 1.0 mIoU,较 VMamba-T 高出 0.6 mIoU。
- Spatial-Mamba-B 在 ADE20K 上实现多尺度 mIoU 52.6,创下基于 SSM 模型在分割任务中的新最先进纪录。
- 采用空洞邻域集合(d=1,3,5)的 SASF 模块使 top-1 准确率从基线的 82.0% 提升至 82.7%,证明其有效性。
- 重参数ization 和 CUDA 优化将吞吐量从 1065 提升至 1438 tokens/ms,推理速度提升至少 30%。
- MESA 与 LPU 的集成分别使准确率提升 0.2% 和 0.4%,证实了增强局部建模与正则化机制的优势。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。