Real-Time Sleep Staging using Deep Learning on a Smartphone for a Wearable EEG

Abhay Koushik, Judith Amores, Pattie MaesarXiv 2018

Introduction

Polysomnography (PSG) is the gold standard for sleep tracking, but its intrusive nature—requiring over 20 wired sensors in a clinical lab—often disrupts the very sleep it aims to measure. While automated wearable alternatives have been developed, they often fail to classify all five standard sleep stages (Wake, N1, N2, N3, REM) in real-time or rely on cloud-based processing that introduces latency and privacy concerns. This paper introduces the first real-time, five-stage sleep classification system that runs entirely on a smartphone using a single-channel wearable EEG.

Methods and Architecture

The system utilizes a modified Muse headband to capture a single channel of frontal EEG data (AF7). The core algorithmic contribution is a Time-Distributed 1-D Deep Convolutional Neural Network (CNN). Unlike previous state-of-the-art models that require long sequences of data (e.g., 25 epochs) to generate labels, this architecture infers the sleep stage from a single 30-second epoch of raw EEG data.

Figure 1: The Time-Distributed 1-D CNN architecture designed for efficient real-time inference on mobile devices.

To ensure the model works across different hardware and subjects, the authors implemented a novel real-time adaptation technique. They apply Z-score scaling calibrated specifically using the standard deviation of the user's wake-stage EEG. Feature importance analysis revealed that the standard deviation of the raw signal holds a 53.33% relative importance for classification, making it an ideal calibration tool. The model is deployed via TensorFlow Lite on an Android smartphone, communicating with the headset via Bluetooth Low Energy (BLE).

Key Results

The model achieved an overall accuracy of 83.5% across 20-fold cross-validation for five-stage classification. On a specific 5-night test set, it maintained an accuracy of 81.72% and an F1-score of 76.23%, performance that is highly competitive with human expert scoring (typically ~80% inter-rater reliability).

Figure 4: Confusion matrix showing model performance. The system excels at detecting Wake and N2 stages but faces challenges with N1.

The system successfully demonstrated real-time detection of REM sleep and wakefulness artifacts during live testing. By moving inference to the edge, the system eliminates cloud reliance, preserving privacy and reducing latency—a prerequisite for real-time sleep interventions.

Limitations and Future Work

A notable limitation is the model's difficulty in classifying the N1 sleep stage (F1-score of 0.44). This is a known constraint of using only frontal EEG electrodes, as N1 detection typically requires occipital sensors to identify specific brain wave patterns.

Future research will leverage this real-time capability for closed-loop Brain-Computer Interfaces (BCI). Proposed applications include wearable olfactory interfaces and audio-neural feedback designed to enhance memory consolidation and learning during sleep.

Summary updated

BibTeX
@misc{koushik2018real,
  author = {Abhay Koushik and Judith Amores and Pattie Maes},
  title = {{Real-Time Sleep Staging using Deep Learning on a Smartphone for a Wearable EEG}},
  year = {2018},
  eprint = {1811.10111},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1811.10111},
}
Figure