MaIR: A Locality- and Continuity-Preserving Mamba for Image Restoration

Recent advancements in Mamba have shown promising results in imagerestoration. These methods typically flatten 2D images into multiple distinct1D sequences along rows and columns, process each sequence independently usingselective scan operation, and recombine them to form the outputs. However, sucha paradigm overlooks two vital aspects: i) the local relationships and spatialcontinuity inherent in natural images, and ii) the discrepancies amongsequences unfolded through totally different ways. To overcome the drawbacks,we explore two problems in Mamba-based restoration methods: i) how to design ascanning strategy preserving both locality and continuity while facilitatingrestoration, and ii) how to aggregate the distinct sequences unfolded intotally different ways. To address these problems, we propose a novelMamba-based Image Restoration model (MaIR), which consists of Nested S-shapedScanning strategy (NSS) and Sequence Shuffle Attention block (SSA).Specifically, NSS preserves locality and continuity of the input images throughthe stripe-based scanning region and the S-shaped scanning path, respectively.SSA aggregates sequences through calculating attention weights within thecorresponding channels of different sequences. Thanks to NSS and SSA, MaIRsurpasses 40 baselines across 14 challenging datasets, achievingstate-of-the-art performance on the tasks of image super-resolution, denoising,deblurring and dehazing. The code is available athttps://github.com/XLearning-SCU/2025-CVPR-MaIR.