Automatic Classification of Sleep Stages from EEG Signals Using Riemannian Metrics and Transformer Networks

Mathieu Seraphim, Alexis Lechervy, Florian Yger, Luc Brun, Olivier Etard · DOI

Introduction

Sleep stage scoring is a fundamental task in sleep medicine, essential for diagnosing various sleep disorders. Traditionally, this process involves experts manually labeling hours of polysomnography (PSG) recordings into 30-second epochs across five stages: Wake, REM, and N1–N3. While deep learning has made significant strides in automating this task, many existing models rely on local features from individual EEG channels, often overlooking the complex "functional connectivity"—the synchronization and interaction between different brain regions.

Methodology: The SPDTransNet Architecture

The researchers introduce SPDTransNet, a novel framework that leverages the geometric properties of EEG signals. By representing brain interactions as Symmetric Positive Definite (SPD) covariance matrices, the model captures functional connectivity within a Riemannian manifold.

Matrix Augmentation and Whitening

To enrich the data, the authors propose a matrix augmentation strategy. This involves injecting signal-wise features, such as Power Spectral Density (PSD) calculated across standard frequency bands, directly into the SPD matrix structure.

Standard EEG frequency bands used for feature extraction and matrix augmentation.

Following augmentation, a whitening operation is applied. This step transports matrices from different subjects or recording setups into a unified geometric neighborhood, mitigating noise and inter-subject variability.

Structure-Preserving Attention

A key innovation is the Structure-Preserving Multihead Attention (SP-MHA). Standard Transformer attention mechanisms use linear projections that can disrupt the SPD property of the matrices. SPDTransNet employs manifold-aware operations to ensure the data remains mathematically consistent as covariance matrices throughout the network. The architecture follows a two-step process: extracting intra-epoch features and then analyzing the inter-epoch sequence to capture temporal context.

Datasets and Evaluation

The model was rigorously evaluated on three public datasets:

  • MASS-SS3: 62 healthy subjects, serving as a primary benchmark.
  • MASS-SS1: 53 older subjects, including those with mild cognitive impairment, representing a more challenging demographic.
  • Dreem DOD-H: 25 subjects, including clinical cases like sleep apnea, testing the model's robustness across diverse conditions.

Results and Discussion

SPDTransNet achieved state-of-the-art performance on the MASS-SS3 dataset with a Macro F1-score (MF1) of 81.24%, rivaling established models like DeepSleepNet.

Crucially, the model demonstrated superior generalization in "Direct Transfer" scenarios. When trained on MASS-SS3 and tested on the older population of MASS-SS1 without retraining, SPDTransNet maintained stable performance (losing <1 point in MF1), whereas competing models saw significant drops. This suggests that functional connectivity, as captured by Riemannian metrics, provides a more universal and stable marker for sleep stages than traditional frequency-based features alone.

Conclusion

SPDTransNet successfully integrates Riemannian geometry with Transformer networks to improve sleep stage classification. While the computational cost of manifold operations and the need for larger datasets remain challenges, the model's ability to preserve data structure and generalize across populations marks a significant advancement. Future work will explore expanding matrix augmentation with more diverse features and transitioning to sequence-to-sequence classification for enhanced global accuracy.

Summary updated

BibTeX
@article{seraphim2024automatic,
  author = {Mathieu Seraphim and Alexis Lechervy and Florian Yger and Luc Brun and Olivier Etard},
  title = {{Automatic Classification of Sleep Stages from EEG Signals Using Riemannian Metrics and Transformer Networks}},
  journal = {SN Comput. Sci.},
  year = {2024},
  doi = {10.1007/s42979-024-03310-5},
}
Figure