A CNN-Transformer Deep Learning Model for Real-time Sleep Stage Classification in an Energy-Constrained Wireless Device<sup>*</sup>
Zongyan Yao, Xilin Liu
Abstract
This paper presents a lightweight deep learning (DL) model for classifying sleep stages based on single-channel EEG. The DL model was designed to run on energy- and memory-constrained devices for real-time operation with all processing on the edge. Four convolutional filter layers are used to extract features and reduce the data dimension, and transformers were utilized to learn the time-variant features of the data. EEG recordings from a publicly available dataset (Sleep-EDF) are used to train and test the model. Subject-specific training was implemented to improve model performance. The testing F1 score was 0.91, 0.37, 0.84, 0.877, and 0.73 for the stages of awake, N1, N2, N3, and rapid eye movement (REM), respectively. The performance of the model was comparable to the state-of-the-art works with significantly greater computational costs. A reduced-size version of the model has been successfully tested on a low-cost Arduino Nano 33 BLE board. This design holds great promise for future integration into a low-power wireless EEG sensor with edge DL for sleep research in pre-clinical and clinical experiments, such as real-time sleep modulation.