  This paper proposes a deep learning (DL) model for automatic sleep stage
classification based on single-channel EEG data. The DL model features a
convolutional neural network (CNN) and transformers. The model was designed to
run on energy and memory-constrained devices for real-time operation with local
processing. The Fpz-Cz EEG signals from a publicly available Sleep-EDF dataset
are used to train and test the model. Four convolutional filter layers were
used to extract features and reduce the data dimension. Then, transformers were
utilized to learn the time-variant features of the data. To improve
performance, we also implemented a subject specific training before the
inference (i.e., prediction) stage. With the subject specific training, the F1
score was 0.91, 0.37, 0.84, 0.877, and 0.73 for wake, N1-N3, and rapid eye
movement (REM) stages, respectively. The performance of the model was
comparable to the state-of-the-art works with significantly greater
computational costs. We tested a reduced-sized version of the proposed model on
a low-cost Arduino Nano 33 BLE board and it was fully functional and accurate.
In the future, a fully integrated wireless EEG sensor with edge DL will be
developed for sleep research in pre-clinical and clinical experiments, such as
real-time sleep modulation.
