  Closed-loop sleep modulation is an emerging research paradigm to treat sleep
disorders and enhance sleep benefits. However, two major barriers hinder the
widespread application of this research paradigm. First, subjects often need to
be wire-connected to rack-mount instrumentation for data acquisition, which
negatively affects sleep quality. Second, conventional real-time sleep stage
classification algorithms give limited performance. In this work, we conquer
these two limitations by developing a sleep modulation system that supports
closed-loop operations on the device. Sleep stage classification is performed
using a lightweight deep learning (DL) model accelerated by a low-power
field-programmable gate array (FPGA) device. The DL model uses a single channel
electroencephalogram (EEG) as input. Two convolutional neural networks (CNNs)
are used to capture general and detailed features, and a bidirectional
long-short-term memory (LSTM) network is used to capture time-variant sequence
features. An 8-bit quantization is used to reduce the computational cost
without compromising performance. The DL model has been validated using a
public sleep database containing 81 subjects, achieving a state-of-the-art
classification accuracy of 85.8% and a F1-score of 79%. The developed model has
also shown the potential to be generalized to different channels and input data
lengths. Closed-loop in-phase auditory stimulation has been demonstrated on the
test bench.
