Explainable vision transformer for automatic visual sleep staging on multimodal PSG signals

Hyojin Lee, You Rim Choi, Hyun Kyung Lee, Jaemin Jeong, Joopyo Hong, Hyunwoo Shin, Hyung-Sin KimNpj Digit. Medicine 2025

Introduction

Polysomnography (PSG) is the gold standard for diagnosing sleep disorders, yet it remains a data-intensive and manual process. Human experts must painstakingly score 30-second "epochs" of multi-channel data, a task that is labor-intensive and prone to subjectivity. While automated deep learning models have emerged, they often function as "black boxes," lacking the transparency required for clinical trust. Furthermore, many models fail to replicate the holistic visual approach used by human technicians who analyze multimodal signals across time.

Traditional visual sleep scoring is labor-intensive and subjective.

The SleepXViT Framework

To address these challenges, we introduce SleepXViT, a Vision Transformer (ViT)-based system designed to mimic the visual workflow of human sleep experts. SleepXViT treats multimodal physiological signals as 2D images, allowing it to leverage advanced computer vision techniques.

The architecture consists of two primary components:

  1. Intra-epoch ViT: This stage processes raw 14-channel PSG signals (including EEG, EOG, and EMG) by stacking them into a standardized image. A Transformer Encoder extracts spatial features within each 30-second window.
  2. Inter-epoch ViT: Recognizing that sleep stages are temporally dependent, this stage uses a sliding window (typically 10 epochs) to capture the sequence context, significantly improving the identification of stages like REM.
The SleepXViT architecture integrates intra-epoch and inter-epoch transformers with an explainability suite.

Explainability and Clinical Utility

A core innovation of SleepXViT is its focus on interpretability. The system provides three layers of explanation:

  • High-Resolution Heatmaps: Using Layer-wise Relevance Propagation (LRP), the model generates heatmaps that highlight specific physiological markers (e.g., spindles or alpha waves) influencing its decision.
  • Calibrated Confidence Scores: The model outputs a certainty metric. Low-confidence predictions are flagged for human review, enabling a reliable "human-in-the-loop" workflow.
  • Temporal Relevance: It visualizes the impact of surrounding epochs on the current classification.

Results and Validation

The model was rigorously tested on the KISS dataset (7.6 million images from 7,745 patients) and externally validated using the SHHS1 and SHHS2 datasets. SleepXViT achieved a state-of-the-art Macro F1 score of 81.94%, outperforming traditional CNN and Transformer baselines. Crucially, the model's confidence scores were well-calibrated, meaning its self-reported certainty accurately reflected its true performance.

Discussion and Future Work

While SleepXViT demonstrates high performance and generalization across different hospital datasets, some areas for improvement remain. The model occasionally focuses on unexpected channels, such as EOG during deep sleep (N3), which may be due to signal leakage. Future work will focus on more diverse demographic cohorts and real-time deployment to measure the actual time savings for clinical technicians.

Conclusion

SleepXViT bridges the gap between automated efficiency and human-like reasoning. By transforming 1D signals into interpretable 2D visual data, it offers a robust, transparent tool that can significantly reduce the manual burden of sleep staging while maintaining high diagnostic standards.

Summary updated

BibTeX
@article{lee2025explainable,
  author = {Hyojin Lee and You Rim Choi and Hyun Kyung Lee and Jaemin Jeong and Joopyo Hong and Hyunwoo Shin and Hyung-Sin Kim},
  title = {{Explainable vision transformer for automatic visual sleep staging on multimodal PSG signals}},
  journal = {Npj Digit. Medicine},
  year = {2025},
  doi = {10.1038/s41746-024-01378-0},
}
Figure