MambaOut: Do We Really Need Mamba for Vision?

Weihao Yu, Xinchao Wang
5/13/2024
cs.CVcs.AIcs.LG

Official code: yuweihao/MambaOut (2,706 stars, Apache-2.0, last commit 2025-03-09). 1 more implementation below.

Abstract

Mamba, an architecture with RNN-like token mixer of state space model (SSM), was recently introduced to address the quadratic complexity of the attention mechanism and subsequently applied to vision tasks. Nevertheless, the performance of Mamba for vision is often underwhelming when compared with convolutional and attention-based models. In this paper, we delve into the essence of Mamba, and conceptually conclude that Mamba is ideally suited for tasks with long-sequence and autoregressive characteristics. For vision tasks, as image classification does not align with either characteristic, we hypothesize that Mamba is not necessary for this task; Detection and segmentation tasks are also not autoregressive, yet they adhere to the long-sequence characteristic, so we believe it is still worthwhile to explore Mamba's potential for these tasks. To empirically verify our hypotheses, we construct a series of models named MambaOut through stacking Mamba blocks while removing their core token mixer, SSM. Experimental results strongly support our hypotheses. Specifically, our MambaOut model surpasses all visual Mamba models on ImageNet image classification, indicating that Mamba is indeed unnecessary for this task. As for detection and segmentation, MambaOut cannot match the performance of state-of-the-art visual Mamba models, demonstrating the potential of Mamba for long-sequence visual tasks. The code is available at https://github.com/yuweihao/MambaOut

View on arXivView PDF

Code Implementations(2)

yuweihao/MambaOutOfficial100%
Apache-2.0

MambaOut: Do We Really Need Mamba for Vision? (CVPR 2025)

2,70649Shell, PythonMay 13, 20241 years agoApache-2.0
PyTorchApache-2.0

The largest collection of PyTorch image encoders / backbones. Including train, eval, inference, export scripts, and pretrained weights -- ResNet, ResNeXT, EfficientNet, NFNet, Vision Transformer (ViT), MobileNetV4, MobileNet-V3 & V2, RegNet, DPN, CSPNet, Swin Transformer, MaxViT, CoAtNet, ConvNeXt, and more

36,9405,171MDX, ShellFeb 2, 20195 months agoApache-2.0
augmixconvnextdistributed-trainingefficientnetimage-classification+15 more

Similar Papers

Cite this paper

@article{yu2024mambaout,
  title  = {MambaOut: Do We Really Need Mamba for Vision?},
  author = {Weihao Yu and Xinchao Wang},
  year   = {2024},
  eprint = {2405.07992},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.07992v3},
  journal = {CVPR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.07992.svg)](https://codeofpaper.com/paper/2405.07992)

Discussion