SP-Mamba: Spatial-Perception State Space Model for Unsupervised Medical Anomaly Detection

Rui Pan, Ruiying LuACM Multimedia 2025

Introduction

Unsupervised Medical Anomaly Detection (UMAD) is a critical task in clinical diagnostics, where models are trained exclusively on "normal" data to identify rare and diverse pathologies. While Convolutional Neural Networks (CNNs) and Transformers have been the mainstays of this field, they face significant trade-offs. CNNs often struggle with long-range dependencies, while Transformers suffer from quadratic computational complexity as image resolution increases. Furthermore, standard architectures often fail to leverage the inherent spatial consistency of medical imaging—where anatomical structures like the heart or lungs occupy predictable locations.

This paper introduces SP-Mamba, a novel framework that adapts the State Space Model (SSM) architecture, specifically Mamba, for medical anomaly detection. By incorporating spatial-perception mechanisms, SP-Mamba achieves state-of-the-art performance with significantly lower computational overhead than Transformer-based alternatives.

Methodology

SP-Mamba is designed as a pyramidal auto-encoder that integrates three primary innovations to enhance spatial awareness and efficiency.

1. Window-Sliding Medical Prototype (MP) Module

Unlike traditional models that compare image patches to a single global template, the MP module utilizes window-sliding prototype learning. It learns representative "normal" features (prototypes) and searches for matches within a localized sliding window. This approach accounts for minor variations in patient positioning—such as a tilted spine or shifted organ—while maintaining strict anatomical consistency, thereby reducing false positives caused by structural noise.

2. Circular-Hilbert Scanning (SPSS Module)

Mamba models typically process 2D images by flattening them into 1D sequences, which can disrupt spatial relationships. SP-Mamba addresses this through a hybrid scanning strategy. It employs a Hilbert curve for the central regions of the image to preserve local 2D clusters and a circular scan for the periphery. This focuses the model’s processing power on central anatomical regions where lesions are most frequently located.

3. Multi-Factor Anomaly Scoring

Beyond standard reconstruction error, SP-Mamba introduces two additional metrics to refine detection:

  • Concentration: This metric leverages the observation that true anomalies tend to be spatially clustered, whereas model noise is typically dispersed.
  • Contrast: Utilizing Difference of Gaussians (DoG), this metric identifies sharp deviations in texture, helping to distinguish subtle lesions from healthy tissue.

Experimental Evaluation

The model was benchmarked against three diverse datasets:

  • ZhangLab Chest X-ray: Focused on pneumonia detection.
  • CheXpert: A large-scale radiograph dataset covering various pathologies.
  • Uni-Medical: A multimodal benchmark including Brain MRI, Liver CT, and Retinal OCT.

Performance and Efficiency

SP-Mamba demonstrated superior performance, achieving an AUC of 92.0% on the ZhangLab dataset and 80.4% on CheXpert. Notably, it outperformed established models like SQUID and SimSID.

In terms of efficiency, SP-Mamba is significantly leaner than its competitors. It utilizes approximately 25.8M parameters and 8.3G FLOPs. In contrast, the Transformer-based SimSID requires over 83M parameters and nearly double the FLOPs, highlighting SP-Mamba's suitability for resource-constrained clinical environments.

Qualitative Localization

Qualitative analysis via heatmaps indicates that SP-Mamba provides superior localization accuracy. It more precisely identifies the boundaries of brain tumors and liver lesions compared to previous Mamba-based iterations like MambaAD, which often produce coarser or less accurate anomaly maps.

Conclusion and Future Work

SP-Mamba represents a significant step forward in unsupervised medical anomaly detection by bridging the gap between the efficiency of State Space Models and the spatial requirements of medical imaging. By treating anatomy as a spatial anchor and optimizing scanning patterns, the model achieves high accuracy with low computational cost.

Future research will focus on extending this framework to 3D volumetric data (e.g., full CT/MRI stacks) and reducing dependency on pre-trained CNN backbones (like ResNet34) to create a "pure" Mamba architecture. Additionally, improving robustness against sensor noise across different hardware manufacturers remains a priority for clinical deployment.

Summary updated

BibTeX
@inproceedings{pan2025sp,
  author = {Rui Pan and Ruiying Lu},
  title = {{SP-Mamba: Spatial-Perception State Space Model for Unsupervised Medical Anomaly Detection}},
  booktitle = {ACM Multimedia},
  year = {2025},
}
Figure