TL;DR
STNMamba is a lightweight, high-performance framework for Video Anomaly Detection (VAD) that leverages the linear complexity of Mamba (State Space Models) to outperform both CNN and Transformer-based methods. By using a dual-encoder strategy and a multi-level interaction module, it achieves state-of-the-art accuracy on major benchmarks while requiring significantly fewer computational resources—operating at just 1.5 GFLOPs and 40 FPS.
What Problem Does This Paper Address?
Video Anomaly Detection (VAD) aims to automatically identify "abnormal" events (like a car on a sidewalk or someone running in a library) in surveillance footage. Because anomalies are rare and unpredictable, most systems use unsupervised learning: they train on "normal" video and flag anything that deviates from those patterns during testing.
The field currently faces a "Goldilocks" problem with architectures:
- CNNs are efficient but have a "local" view, often missing long-range relationships across a frame or over time.
- Transformers capture global context perfectly but suffer from quadratic complexity. As video resolution or sequence length increases, the computational cost explodes, making them difficult to deploy on "edge" devices like smart cameras.
The authors tackle this by adapting Mamba, a recent breakthrough in State Space Models (SSMs) that provides the global modeling power of Transformers but with the linear efficiency of CNNs.
Methods
The authors introduce STNMamba, which consists of several novel components designed to handle the specific challenges of video data:
- Dual-Encoder Architecture: The model processes appearance (RGB frames) and motion (frame differences) through two separate streams.
- Multi-Scale Vision Space State Block (MS-VSSB): Standard Mamba blocks can miss small objects. This module adds parallel depth-wise convolutions with different kernel sizes to the Mamba architecture, allowing the model to "see" anomalies at various scales.
- Channel-Aware Vision Space State Block (CA-VSSB): To better capture motion, this block integrates channel attention, helping the model focus on the most significant moving parts of a scene.
- Spatial-Temporal Interaction Module (STIM): Unlike traditional models that only fuse spatial and temporal data at the very end (the "bottleneck"), STIM integrates these features at multiple levels. This ensures that both fine-grained details and high-level semantics are consistent across space and time.
- Hierarchical Memory Bank: The model stores "prototypes" of normal behavior in a learnable memory bank. During testing, if a video segment cannot be easily represented using these stored normal patterns, it is assigned a high anomaly score.
Datasets
The model was evaluated on three standard VAD benchmarks:
- UCSD Ped2: A simpler dataset of a pedestrian walkway.
- CUHK Avenue: Contains more complex "abnormal" behaviors like loitering or throwing objects.
- ShanghaiTech: One of the largest and most challenging VAD datasets, featuring 13 scenes and complex lighting/vantage points.
Key Insights and Ideas
- Mamba is a VAD Game-Changer: This is the first work to successfully adapt Mamba for unsupervised VAD. It proves that you don't need the heavy overhead of Self-Attention to achieve global spatial-temporal reasoning.
- Multi-Level Fusion Matters: The paper demonstrates that fusing spatial and temporal information at every stage of the encoding process (rather than just at the end) is critical for capturing the "intrinsic consistency" of a video.
- Efficiency without Sacrifice: The most "aha" moment is the efficiency gap. STNMamba achieves better accuracy than models like MNAD or AMMC-Net while using a fraction of the FLOPs (1.5G vs. 46.6G or 169.5G).
Key Results
- State-of-the-Art Accuracy: STNMamba achieved a frame-level AUC (Area Under the Curve) of 98.0% on UCSD Ped2, 89.0% on CUHK Avenue, and 74.9% on the difficult ShanghaiTech dataset.
- Extreme Efficiency:
- FLOPs: Only 1.5G, compared to 18.9G for the previous best Transformer-based model (ASTT).
- Parameters: Just 7.2M, making it small enough for mobile or embedded deployment.
- Speed: Runs at 40 FPS on a standard GPU, meeting the requirements for real-time surveillance.
Limitations and Future Work
While STNMamba is highly efficient, the authors note that it currently relies on frame differences as a proxy for motion. While faster than calculating optical flow, frame differences can be noisy in scenes with significant lighting changes.
The authors suggest that future work could involve scaling this architecture to other video-related tasks, such as video action recognition or future frame prediction in open-world environments, where the linear complexity of Mamba would provide even greater advantages as sequence lengths grow.
Summary updated