Abstract
Motor Imagery (MI) classification is a fundamental task in Brain-Computer Interface (BCI) research, requiring the extraction of complex patterns from non-stationary Electroencephalography (EEG) signals. While Convolutional Neural Networks (CNNs) and Transformers have been widely used, they suffer from limited receptive fields and quadratic computational complexity, respectively. This paper presents STMambaNet, a novel architecture leveraging the Mamba state space model to capture long-range spatial-temporal dependencies with linear scalability. Experimental results on the BCI Competition IV 2a and 2b datasets demonstrate that STMambaNet achieves state-of-the-art performance, reaching accuracies of 82.37% and 89.36%, respectively.
1. Introduction
Brain-Computer Interfaces (BCIs) enable direct communication between the human brain and external devices. Motor Imagery (MI)—the mental rehearsal of physical movement—is a primary paradigm for BCIs, particularly in neurorehabilitation and assistive technology. However, decoding EEG signals remains challenging due to their low signal-to-noise ratio and the non-stationary nature of sensorimotor rhythms (SMR).
Current deep learning approaches face significant trade-offs. CNNs (e.g., EEGNet) excel at capturing local patterns but often fail to model long-range dependencies due to their limited receptive fields. Conversely, Transformers utilize self-attention mechanisms to capture global context but face a "memory wall" due to quadratic computational complexity ($O(L^2)$), making them less efficient for high-resolution EEG sequences. STMambaNet addresses these limitations by utilizing the Mamba architecture, which provides the modeling power of Transformers with the efficiency of linear scaling ($O(L)$).
2. Methodology: The STMambaNet Architecture
The STMambaNet architecture is designed to process EEG data through three distinct stages: Multi-Scale Embedding, Dual Mamba Encoding, and Hybrid Classification.
2.1 Multi-Scale Embedding
To handle the multi-frequency nature of EEG signals, the model first passes raw data through a multi-scale temporal convolution module. This module consists of six parallel branches with varying kernel sizes, allowing the network to extract features across different temporal resolutions simultaneously. This ensures that both rapid oscillations and slower rhythmic changes are captured before being fed into the Mamba blocks.
2.2 Dual Mamba Encoders
The core of the network lies in its selective State Space Model (SSM) blocks. Unlike standard sequence models, STMambaNet employs a dual-stream approach:
- Temporal Mamba Encoder: This module treats time steps as tokens. It models the evolution of brain activity over the duration of the MI task, capturing long-term dependencies that CNNs might miss.
- Spatial Mamba Encoder: In a novel application of the Mamba block, the data is transposed to treat EEG channels as tokens. This allows the model to learn functional connectivity and spatial relationships between different brain regions (e.g., the motor cortex across hemispheres).
2.3 Hybrid Classifier
The features extracted from the spatial and temporal streams are integrated and processed through a series of convolutional layers and fully connected layers. This hybrid approach ensures that the high-level representations learned by the Mamba blocks are effectively mapped to the specific MI classes (e.g., left hand vs. right hand).
3. Experimental Evaluation
The model was validated on two gold-standard benchmark datasets:
- BCI Competition IV 2a: A 22-channel, 4-class dataset (left hand, right hand, feet, tongue) involving 9 subjects.
- BCI Competition IV 2b: A 3-channel, 2-class dataset (left vs. right hand) involving 9 subjects.
3.1 Performance Results
STMambaNet demonstrated superior classification accuracy compared to established models:
- BCI IV 2a: The model achieved an average accuracy of 82.37%, significantly outperforming the Transformer-based ST-DG (75.27%) and the popular EEGNet (78.55%). Notably, STMambaNet achieved the highest accuracy for 7 out of the 9 subjects in this dataset.
- BCI IV 2b: The model reached an average accuracy of 89.36%.
3.2 Ablation Study and Efficiency
Ablation studies confirmed the necessity of the dual-encoder design. Removing either the spatial or temporal Mamba component resulted in a marked decrease in performance, highlighting the importance of modeling both dimensions of the EEG signal. Furthermore, the Mamba-based architecture maintained linear computational complexity, offering a more scalable solution for real-time BCI applications compared to Transformer-based alternatives.
4. Discussion and Conclusion
The success of STMambaNet suggests that state space models are highly effective for physiological signal processing. The model's ability to treat EEG channels as spatial "tokens" is particularly innovative, though its advantage is more pronounced in high-density electrode configurations. In the 3-channel BCI IV 2b dataset, the performance gain was narrower, suggesting that the spatial Mamba encoder benefits from a larger "spatial sequence" to model complex inter-channel relationships.
Future research will focus on evaluating STMambaNet with high-density EEG (64+ channels) and exploring its generalizability in cross-subject transfer learning scenarios, where the goal is to minimize the calibration time required for new users.
Summary updated