TL;DR
This paper introduces a deep transfer learning method that enhances automatic sleep staging accuracy for small datasets by leveraging knowledge from large datasets, addressing data variability and inefficiency issues.
Contribution
It presents a novel transfer learning framework for sleep staging that significantly improves performance on small cohorts by fine-tuning pretrained models from large datasets.
Findings
Significant performance improvements on target datasets.
Effective transfer learning across different sleep study datasets.
Addresses data variability and small data challenges.
Abstract
Background: Despite recent significant progress in the development of automatic sleep staging methods, building a good model still remains a big challenge for sleep studies with a small cohort due to the data-variability and data-inefficiency issues. This work presents a deep transfer learning approach to overcome these issues and enable transferring knowledge from a large dataset to a small cohort for automatic sleep staging. Methods: We start from a generic end-to-end deep learning framework for sequence-to-sequence sleep staging and derive two networks as the means for transfer learning. The networks are first trained in the source domain (i.e. the large database). The pretrained networks are then finetuned in the target domain (i.e. the small cohort) to complete knowledge transfer. We employ the Montreal Archive of Sleep Studies (MASS) database consisting of 200 subjects as the…
| Database | MASS | Sleep-EDF-SC | Sleep-EDF-ST | Surrey-cEEGrid | |
| Input | C4-A1 | Fpz-Cz | Fpz-Cz | cEEGrid | |
| Accuracy | (in-domain) | (out-of-domain) | (out-of-domain) | (out-of-domain) | |
| Mismatch | - | slight | slight | severe |
| Num. of subjects | EEG | EOG | EMG | Data mismatch | ||
| MASS | 200 | C4-A1 | ROC-LOC | CHIN1-CHIN2 | - | |
| Sleep-EDF-SC | 20 | Fpz-Cz | ROC-LOC | - | slight | |
| Sleep-EDF-ST | 22 | Fpz-Cz | ROC-LOC | Submental | slight | |
| Surrey-cEEGrid | 12 | cEEGrid | ROC-A2 | CHIN1-CHIN3 | severe |
| SeqSleepNet | DeepSleepNet | ||||||
| Input | Acc. | MF1 | Acc. | MF1 | |||
| EEGEOGEMG | |||||||
| EEGEOG | |||||||
| EEG | |||||||
| EOG | |||||||
| System | Transfer learning | EEGEOGEMG EEGEOGEMG | EEGEOGEEGEOG | EEGEEG | EOGEOG | EEGEOG | ||||||||||||
| Acc. | MF1 | Acc. | MF1 | Acc. | MF1 | Acc. | MF1 | Acc. | MF1 | |||||||||
| Sleep-EDF-SC | FT SeqSleepNet+ | Yes | ||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||
| Personalized Deep CNN∗ [9] | Yes | |||||||||||||||||
| VGG-FT [18] | Yes | |||||||||||||||||
| VGG-FE [18] | Yes | |||||||||||||||||
| ResNet [37] | Yes | |||||||||||||||||
| U-time [61]† | No | |||||||||||||||||
| IITNet [62]† | No | |||||||||||||||||
| DeepSleepNet† [6] | No | |||||||||||||||||
| Multitask 1-max CNN [5] | No | |||||||||||||||||
| 1-max CNN [17] | No | |||||||||||||||||
| Attentional RNN [25] | No | |||||||||||||||||
| Deep auto-encoder [41] | No | |||||||||||||||||
| Deep CNN [7] | No | |||||||||||||||||
| Decision trees [63]‡ | No | |||||||||||||||||
| -NN [64]‡ | No | |||||||||||||||||
| GMM [65]‡ | No | |||||||||||||||||
| Sleep-EDF-ST | FT SeqSleepNet+ | Yes | ||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||
| SVM + Scattering Trans. [66] | No | |||||||||||||||||
| Decision trees. [67] | No | |||||||||||||||||
| Surrey-cEEGrid | FT SeqSleepNet+ | Yes | ||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||
| Random Forests⋄ [11] | No | |||||||||||||||||
| System | Transfer learning | EEGEOGEMGEEGEOGEMG | EEGEOGEEGEOG | EEGEEG | EOGEOG | EEGEOG | ||||||||||||||||||||||
| W | N1 | N2 | N3 | REM | W | N1 | N2 | N3 | REM | W | N1 | N2 | N3 | REM | W | N1 | N2 | N3 | REM | W | N1 | N2 | N3 | REM | ||||
| Sleep-EDF-SC | FT SeqSleepNet+ | Yes | ||||||||||||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||||||||||||
| Sleep-EDF-ST | FT SeqSleepNet+ | Yes | ||||||||||||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||||||||||||
| Surrey-cEEGrid | FT SeqSleepNet+ | Yes | ||||||||||||||||||||||||||
| FT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT SeqSleepNet+ | Yes | |||||||||||||||||||||||||||
| DT DeepSleepNet+ | Yes | |||||||||||||||||||||||||||
| Scratch SeqSleepNet+ | No | |||||||||||||||||||||||||||
| Scratch DeepSleepNet+ | No | |||||||||||||||||||||||||||
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Towards More Accurate Automatic Sleep Staging via Deep Transfer Learning
Huy Phan*∗*, Oliver Y. Chén, Philipp Koch, Zongqing Lu, Ian McLoughlin, Alfred Mertins, and Maarten De Vos H. Phan is with the School of Electronic Engineering and Computer Science, Queen Mary University of London, London E1 4NS, UK. I. McLouglin is with Singapore Institute of Technology, Singapore 138683. O. Y. Chén is with the Institute of Biomedical Engineering, University of Oxford, Oxford OX3 7DQ, UK. Z. Lu is with the Department of Computer Science, Peking University, Beijing, 100080, China. P. Koch and A. Mertins are with the Institute for Signal Processing, University of Lübeck, Lübeck 23562, Germany. M. De Vos is with the Department of Electrical Engineering and the Department of Development and Regeneration, KU Leuven, 3001 Leuven, Belgium.∗Corresponding author: [email protected]
Abstract
Background: Despite recent significant progress in the development of automatic sleep staging methods, building a good model still remains a big challenge for sleep studies with a small cohort due to the data-variability and data-inefficiency issues. This work presents a deep transfer learning approach to overcome these issues and enable transferring knowledge from a large dataset to a small cohort for automatic sleep staging. Methods: We start from a generic end-to-end deep learning framework for sequence-to-sequence sleep staging and derive two networks as the means for transfer learning. The networks are first trained in the source domain (i.e. the large database). The pretrained networks are then finetuned in the target domain (i.e. the small cohort) to complete knowledge transfer. We employ the Montreal Archive of Sleep Studies (MASS) database consisting of 200 subjects as the source domain and study deep transfer learning on three different target domains: the Sleep Cassette subset and the Sleep Telemetry subset of the Sleep-EDF Expanded database, and the Surrey-cEEGrid database. The target domains are purposely adopted to cover different degrees of data mismatch to the source domains. Results: Our experimental results show significant performance improvement on automatic sleep staging on the target domains achieved with the proposed deep transfer learning approach. Conclusions: These results suggest the efficacy of the proposed approach in addressing the above-mentioned data-variability and data-inefficiency issues. Significance: As a consequence, it would enable one to improve the quality of automatic sleep staging models when the amount of data is relatively small. 111The source code and the pretrained models are published at http://github.com/pquochuy/sleep_transfer_learning.
{IEEEkeywords}
Automatic sleep staging, sequence-to-sequence, deep learning, transfer learning.
1 Introduction
Sleep scoring [1, 2] aims to determine sleep stages from polysommography (PSG) recordings. In clinical environments, this task has been mainly performed manually by clinicians following developed guidelines [1, 2]. Since the manual scoring is time-consuming, costly, and prone to human errors, automating the scoring process has been a long-lasting focus in the sleep research community [3, 4, 5, 6, 7, 8, 9, 10]. Automatic sleep scoring is particularly important in home-based sleep monitoring [11, 12, 13, 14]. Recent years have seen a new generation of mobile electroencephalography (EEG) devices that provide a cost-effective solution to screen a wide population for epidemiological studies and to monitor specific populations at risk of sleep disorders.
Deep learning has been successfully applied to numerous domains and has received much attention from the sleep research community. Past work has looked at various deep network architectures, such as deep neural networks (DNNs) [15], convolutional neural networks (CNNs) [7, 16, 17, 10, 18, 19, 8, 20, 21, 22, 23, 24], and recurrent neural networks (RNNs) [25, 26, 27, 28], and novel ways to carry out sleep staging like sequence-to-sequence classification scheme [4, 6]. Reviews of the most recent progress on deep learning for automatic sleep staging can be found in [29, 30, 31]. However, considerably less attention has been paid to make sleep staging models more robust to the challenges of sleep data variability and to make them data-efficient (i.e. using less data). Despite the fact that the performance of machine’s sleep staging has been on par with manual scoring by sleep experts [4, 8, 6, 20, 21, 22, 23], we have not seen it widely adopted clinically. This is arguably due to two major technical drawbacks of the sleep staging models: data variability and data inefficiency.
Data variability: PSG signals recorded in a particular recording setup are characterized by a number of parameters such as sensors’ frequency response and output level, and signal processing applied to the raw signal. These factors contribute to the transfer function of the recording device and affect how the physiological signals are converted into digital PSG output. As a result, sleep data recorded in different setups may have different transfer functions due to the variations in their underlying hardware and software processing pipelines. Furthermore, discrepancies in channel layouts [8] and cohort characteristics [32] are also likely in different sleep studies. From the viewpoint of machine learning models, these variations and discrepancies lead to domain shift or mismatch between sleep data sources. Data mismatch across different acquisition conditions are computationally significant, degrading the accuracy of sleep staging models on unseen data with a novel recording condition. Therefore, if a sleep staging model is deployed on an unseen sleep data whose properties differ from the data used for training the model, the data mismatch can result in poor inference performance. As evidenced in our experiments (cf. Section 5.3) and shown in Table 1, the single-channel SeqSleepNet [4] model trained on the MASS database suffers from an accuracy drop when it is evaluated out of domain (i.e. being tested on other three databases Sleep-EDF-SC, Sleep-EDF-ST, and Surrey-cEEGrid) relative to the one obtained with in-domain evaluation (i.e. via cross-validation on the MASS database itself). The performance loss depends on the level of data mismatch.
Data inefficiency: Existing deep-learning based sleep staging models cannot escape from the curse of data inefficiency of the deep learning paradigm. That is, training a deep neural network generally requires a large amount of data. In fact, expert-level performance on automatic sleep staging is only obtainable with these models when the training cohort is large, i.e. hundreds or thousands of subjects [4, 8]. The networks’ performances decline significantly when they are trained with a small cohort (e.g. ten or twenty subjects [33, 6]). Unfortunately, in practice, many sleep studies only have access to a small cohort, in the order of a few dozens of subjects [34, 35, 36, 32, 37, 11]. Thus, the small data in these studies hinder deep learning models to perform well.
An easy and obvious solution for the above-mentioned obstacles is to collect training data from all types of recording setups (e.g. recording devices, channel layouts, and preprocessing softwares) that will be foreseeably encountered in the deployment phase. However, this is an expensive, time-consuming, and even infeasible solution. First, most of large sleep databases are proprietary, making those inaccessible for research purposes. Second, even if they are available, a huge effort would be required to score these data manually. Third, novel setups will likely emerge when one studies a particular sleep disorder [32, 37] or when one explores the feasibility of a new monitoring device [11].
In this work, we present a practical solution based on transfer learning to tackle these obstacles, to build more accurate sleep staging models when the available data is small, and to recover the performance of the models otherwise lost due to data variability. We leverage a reasonably large sleep database, which is publicly available, and use a sleep-staging deep neural network as a device to transfer knowledge from this database to improve sleep staging performance on another small cohort with a different recording setup. More specifically, the network is firstly trained with the large database (the source domain) and subsequently finetuned with the small cohort (the target domain) to complete transfer learning. In this context, finetuning means a part or the entire of the pretrained network is further trained with the target domain data. The main contributions of this work include:
- •
A new perspective of looking at data variability and data inefficiency in the automatic sleep staging problem, and developing a deep transfer learning approach to overcome sleep data mismatch and enable knowledge transfer to improve sleep-staging performance on small cohorts. In-depth investigation into the influence of the number of subjects on the transfer learning performance was also conducted.
- •
The generalization of a sequence-to-sequence sleep staging framework from which two state-of-the-art models SeqSleepNet+ and DeepSleepNet+ are developed and used in the study.
- •
A systematic study highlighting different target domains with varying data-mismatch degrees to the source domain, different transfer learning scenarios (i.e. single-channel and multi-channel input), different finetuning strategies, and different state-of-the-art sleep staging models. Our transfer learning approach outperforms all the tested baselines and existing works in solving the automatic sleep staging on the target sleep databases.
This work extends our preliminary work in [33] in several aspects. First, we study transfer learning with a wider spectrum of channel combinations for the networks’ input rather than a single channel. Second, the studies in [33] employed SeqSleepNet [4] as the transfer learning device, here the studies are carried out on two different networks inherited from SeqSleepNet [4] and DeepSleepNet [6]. These two state-of-the-art networks are diverging in their architectures [38]; therefore, it is important to examine if these dissimilarities give rise to any difference in their performance and to explain their behaviors in transfer learning. Third, the work in [33] only studied deep transfer learning on the Sleep-EDF-SC as the target domain. Here, we cover multiple target domains with varying degrees of channel mismatch. Fourth, we study in-depth the influence of the number of target subjects on the transfer learning’s performance.
2 Materials
2.1 Source Domain
We adopted the public Montreal Archive of Sleep Studies (MASS) database [39] as the source domain in this study as it is sufficiently large.
MASS: This database was pooled from different hospital-based sleep laboratories, consisting of whole-night recordings from 200 subjects (97 males and 103 females) aged between 18 and 76 years. Manual annotation was accomplished by sleep experts according to the AASM standard [1] (SS1 and SS3 subsets) or the R&K standard [2] (SS2, SS4, and SS5 subsets). As in [5, 4], we converted different annotations into five sleep stages {W, N1, N2, N3, and REM} and expanded 20-second epochs into 30-second ones by including 5-second segments before and after each epoch. We used the C4-A1 EEG, ROC-LOC EOG, and CHIN1-CHIN2 EMG in our experiments.
2.2 Target Domains
Three different sleep databases are used as the target domains. These adopted cohorts have diverging health conditions, i.e. healthy (Sleep-EDF-SC) vs. mild sleep difficulty (Sleep-EDF-ST) [34, 35], and channel characteristics (i.e. traditional PSG recording (Sleep-EDF-SC and Sleep-EDF-ST) vs. wearable around-the-ear EEG recordings (Surrey-cEEGrid) [11, 40]).
Sleep-EDF-SC: This is the Sleep Cassette (SC) subset of the Sleep-EDF Expanded dataset [34, 35], consisting of 20 subjects aged 25-34. Two subsequent day-night PSG recordings were collected for each subject, except for subject 13 who has only one-night data. Each 30-second PSG epoch was manually labelled into one of eight categories {W, N1, N2, N3, N4, REM, MOVEMENT, UNKNOWN} by sleep experts according to the R&K standard [2]. Similar to previous works [7, 41, 6, 5, 17, 25], N3 and N4 stages were merged into a single stage N3 and MOVEMENT and UNKNOWN categories were excluded. Since full EMG recordings are not available, we only adopted the Fpz-Cz EEG and ROC-LOC EOG (i.e. the EOG horizontal) channels in this study. As this database has been used differently in literature, it should be stressed that only the in-bed parts (from lights off time to lights on time) of the recordings were used as recommended in [42, 43, 7, 41, 5, 17, 25].
Sleep-EDF-ST: This is the Sleep Telemetry (ST) subset of the Sleep-EDF Expanded dataset[34, 35] which was collected for studying the temazepam effects on sleep. The subset consists of 22 Caucasian subjects (7 males and 15 females) aged 18-79 with mild difficulty falling asleep. Although the PSG signals were recorded for two nights, one after temazepam intake and one after placebo intake, only the placebo nights are available. Manual annotation was done similar to the Sleep-EDF-SC subset. Beside Fpz-Cz EEG and ROC-LOC EOG, the submental EMG channel is available and additionally adopted. Similar to the the Sleep-EDF-SC subset, only the in-bed parts of the recordings were used.
Surrey-cEEGrid: This database [11, 40] was recorded at the University of Surrey using the cEEGrid array [44, 45], a novel lightweight flex‐printed electrode strip that fits neatly behind the ear, as illustrated in Figure 1 (a). Twenty participants, aged 34.9 ± 13.8 years, had their overnight (about 12 hours) cEEGrid data collected. The PSGs were also recorded in parallel and manual annotation based on the PSG was used as reference for the cEEGrid data [11]. Besides two recordings lost due to human error, six recordings were discarded because of excessive artifacts and missing data. A cohort of 12 participants was retained. From the cEEGrid data, the FB(R) (“front versus back” for the right ear, see Figure 1 (b)) EEG derivation, which was the best derivation [11], was obtained and used. We also simulated the two- and three-channel settings by adding the ROC-A2 EOG and CHIN1-CHIN3 channels from the PSG data to the cEEGrid data. Although there exist other EOG and EMG channels, the ROC-A2 EOG and CHIN1-CHIN3 channels were deliberately selected to be different from those of the source domain to maintain the severity of data mismatch.
The employed databases and the adopted signals are summarized in Table 2. All the signals were downsampled to 100 Hz. The databases were chosen to have the data mismatch between the target domains and the source domain varying from slight level due to the difference in PSG signals used (i.e. Sleep-EDF-SC and Sleep-EDF-ST) to severe level due to completely new electrode placement (i.e. Surrey-cEEGrid).
3 The Generic Deep Learning Framework for Sequence-to-Sequence Sleep Staging
The advent of deep learning has made astonishing progress in automatic sleep staging. First, deep networks are powerful in learning features which outperform and displace traditional handcrafted features. Second, they enable us to achieve automatic sleep stage classification in ways that are impossible for conventional machine-learning algorithms. The sequence-to-sequence sleep staging scheme [4] was recently proposed to offer the ability of modelling long-term temporal dependency of sleep data epochs in a deep learning model. Intuitively, a sequence-to-sequence model processes a sequence of multiple consecutive epochs simultaneously and classifies them at once into a sequence of corresponding sleep stages. Here, we frame this scheme into a generic deep learning framework for sequence-to-sequence sleep staging. This framework also sets a potential benchmark to design new models in future work. It is worth noting beforehand that a detail explanation of the network layers and machine learning concepts encountered in the following sections, such as an RNN or a CNN, can be found in [46].
3.1 The framework
Formally, given the input sequence of consecutive epochs denoted as , the sequence-to-sequence sleep staging problem [4] is formulated to maximize the conditional probability where represents the sequence of corresponding one-hot encoding vectors of the ground-truth output labels.
The proposed framework are divided into three components, an epoch processing block (EPB), a sequence processing block (SPB), and a softmax layer, as illustrated in Fig. 2.
EPB: Each epoch in the input sequence is presented to the network in some forms of representation (e.g. raw signals [6] or time-frequency features [4]) and can be single-channel (e.g. EEG or EOG) or multi-channel (e.g. a combination of EEG, EOG, and EMG). The EPB plays the role of an epoch-wise feature learner and extractor. The EPB is common for the PSG epochs in the input sequence and is a sub-network that is trained jointly with other components in an end-to-end manner [4]. Via the EPB, an input epoch , , is transformed into an epoch-wise feature vector .
SPB: The SPB consists of a bidirectional recurrent layer (biRNN) that encodes the sequence of the induced epoch-wise feature vectors into the sequence of output vectors . An RNN is a type of deep neural networks that processes an input sequence one element at a time and retain information of all the past elements of the sequence in its hidden state vector [47]. A biRNN, on the other hand, consists of two RNN layers of opposite directions to the same input sequence [48]. More specifically, the forward and backward recurrent layers of the biRNN iterate over the sequence in opposite directions and compute their forward and backward sequences of hidden state vectors and , respectively, where
[TABLE]
In (1) and (2), denotes the hidden layer function of the biRNN and can be realized by either Long Short-Term Memory (LSTM) [49] or Gated Recurrent Unit (GRU) [50], two most popular RNN variants. The sequence of output vectors is then computed:
[TABLE]
where represents vector concatenation. In (3), denotes a learnable weight matrix and denotes a learnable bias. The (long-term) dependency of the input epochs are expected to be modelled by the biRNN layer and the output vectors , are expected to encode sequence-level information. A residual connection can be optionally used to integrate epoch-wise features and sequence-wise features and, hence, enables the network to explore their combination in the classification stage. The fully-connected layer (FC) of the residual connection is to convert into another vector having its size compatible to for a proper residual combination. All the residual connections also share their parameters.
Softmax: The classification is carried out by the shared softmax layer to yield the output sequence of sleep stage probabilities from the sequence of output vectors . Different from SeqSleepNet in [4] and DeepSleepNet in [6], we use a common softmax layer for classification at all indices to reduce the number of network parameters rather than one separate softmax layer at each of the indices. A network that adheres to this framework can be trained to minimize the sequence classification loss over training sequences in the training data:
[TABLE]
Here, represents the network parameters and denotes the hyper-parameter that trades off the error terms and the -norm regularization term.
3.2 The derived networks
From the framework presented in Section 3.1, we develop two networks as the base models for transfer learning:
SeqSleepNet+: This network is similar to SeqSleepNet presented in [4], except that a common softmax layer is used at all indices of the input sequence. Hence, SeqSleepNet+ is more compact than SeqSleepNet [4]. The network receives the log-scale time-frequency representation [4] as input. The time-frequency image is normalized to zero-mean and unit standard deviation. In case of multi-channel, the channel-wise image features are stacked as a multi-channel image. The network’s EPB is realized by filterbank layers [17, 4], one for each input image channel for preprocessing purpose, followed by an attentional biRNN as illustrated in Figure 3(a). Note that this EBP’s biRNN should not be confused with the SBP’s biRNN in Fig. 2. Both the EPB’s biRNN and the SPB’s biRNN of the network are implemented by a GRU cell [50] with recurrent batch normalization [51]. There is no residual connection (cf. Figure 2) in the SPB of this network.
DeepSleepNet+: This network is inherited from DeepSleepNet [6] and its end-to-end variant [4], except for the common softmax used at all indices of the input sequence. The network receives raw signals as input. When the input are composed of multiple signals, the raw signal are stacked to form a multi-channel input. The network’s EPB is composed of two deep CNNs organized in two branches with 4 convolutional layers each as illustrated in Figure 3(b). A CNN is a type of deep neural networks designed to efficiently process data that come in the form of multiple arrays [47], such as one-dimensional signals in this case. A CNN features local connections, shared weights, and pooling to learn translation-invariant features from the input. The convolutional kernels in the two branches are purposely designed to have different sizes so that they can learn features at both fine and coarse temporal resolutions. Each convolutional layer is associated with batch normalization [52] and Rectified Linear Units (ReLU) activation [53]. The SPB’s biRNN relies on the LSTM cell [49] and is designed to have two bidirectional LSTM layers, one stacked on top of the other. In addition, the SPB makes use of the residual connection.
As the two networks inherits SeqSleepNet’s and DeepSleepNet’s architecture’s, respectively, they are divergent in their inputs, EPB, and SPB components [38]. Therefore, these differences suggest discrepant behaviors during transfer learning.
4 Transfer Learning Scenarios for Automatic Sleep Staging on Small Cohorts
Formally, let denote the source domain with the feature space and the label space . In addition, let denote the task in the source domain with the source conditional probability distributions , where and . Similarly, denotes the target domain with the feature space and the label space . denotes the task in the target domain with the conditional probability distributions , where and , respectively. The objective of transfer learning is to improve learning with information gained from and where or [54]. In our case, , as we aim at performing sleep staging with the same set of sleep stages in both the source and target domains. Transfer learning [54] relaxes the hypothesis that the training data must be identically distributed as the test data. Therefore, it is useful to deal with data mismatch and holds promise to leverage the large amount of available data to overcome the problem of having insufficient training data in small cohort studies.
In the present context, a model (e.g. SeqSleepNet+ or DeepSleepNet+) is firstly trained in the source domain and then finetuned in the target domain to complete knowledge transfer as illustrated in Figure 4. Without loss of generality, the pretraining process is to minimize the loss over the source-domain data, resulting in the model parameter :
[TABLE]
The pretrained model is considered as a starting point in the target domain. To accomplish transfer learning, a subset of the pretrained network’s parameter is finetuned (i.e. further trained) with the target-domain data while the rest remains unchanged (i.e. being reused):
[TABLE]
When , the entire pretrained network is finetuned in the target domain. In contrast, when , no finetuning happens and the pretrained network is directly used in the target domain.
In order to study the influence of finetuning different components of a pretrained SeqSleepNet+ and DeepSleepNet+ to the sleep staging performance on the target domains, we examine four finetuning strategies corresponding to different component combinations: all, EPB+softmax, SPB+softmax, and softmax. The parameter subsets corresponding to these combinations will be adapted with the target-domain data while the rest remains fixed. The case in which the pretrained network is directly used in the target domain without finetuning is considered as a baseline. The finetuning strategies are carried out to study the following transfer learning scenarios:
EEGEOGEMGEEGEOGEMG: Apart from brain activities, sleep also involves eye movements and muscular activities at different levels. For instance, Rapid Eye Movement (REM) stage usually associates with rapid eye movements and high muscular activities are usually seen during the Awake stage. Therefore, EOG and EMG are valuable additional sources, complementing EEG in the automatic sleep staging task [8, 9, 10, 37, 5]. We study this three-channel EEGEOGEMG transfer learning scenario when all EEG, EOG, and EMG are available in a target domain (i.e. in case of Sleep-EDF-ST and Surrey-cEEGrid).
EEGEOGEEGEOG: This scenario assumes the unavailability of EMG and examines two-channel EEG·EOG transfer learning. Different from the three-channel case, we are able to study this scenario across all the adopted target domains as they all have full EEG and EOG recordings available.
EEGEEG: This scenario explores single-channel EEG transfer learning. Automatic sleep staging with single-channel EEG is prevalent in literature [55, 41, 17, 25, 56, 57]. Without the augmentation from EOG and EMG, this single-channel setting usually results in a lower performance compared to those of the multi-channel ones; however, it is desirable due to the simple configuration. It is particularly useful for sleep monitoring applications with mobile EEG devices [11, 40].
EOGEOG: In general, EOG signals contain rich information from multiple sources, including ocular activity, frontal EEG activity, and EMG from cranial and eye muscles [36]. They are, therefore, promising alternatives for EEG in single-channel sleep staging. In addition, due to the ease of electrode placements, it would be ideal for home-based sleep monitoring applications with wearable devices [11, 40]. Despite their potential, EOG signals have been mainly used as secondary modality in multi-channel sleep staging studies [36, 58]. With this scenario, we aim to exploit standalone EOG and deep transfer learning on this secondary modality to examine whether its performance is comparable to that using the primary EEG in single-channel sleep staging.
EEGEOG: As an extension of the EOGEOG scenario, this cross-modality transfer learning scenario investigates whether a base model trained on EEG in the source domain can be transferred to EOG in the target domain and if its performance is comparable to the same-domain EOGEOG transfer learning scenario. If the answers to these questions are true, instead of modality-specific pretrained models, a single model pretrained solely on EEG can serve as a generic model for single-channel transfer learning regardless the modality of the target domain.
Apart from the data mismatch caused by the differences in recording devices and/or electrode placements in case of the same-modality scenarios (i.e. EEGEOGEMGEEGEOGEMG, EEGEOGEEGEOG, EEGEEG, and EOGEOG), heavy data mismatch is expected in case of the cross-modality EEGEOG scenario when the base models are trained with EEG data in the source domain is transferred to EOG data in the target domains. On the one hand, with the same-modality scenarios, we aim to show that even when the source domain and the target domains are of the same modalities, transfer learning is still necessary. On the other hand, the cross-modality scenario is to emphasize that transfer learning is efficient in tackling heavy data mismatch to transfer knowledge from the source domain to the target domains.
5 Experiments
5.1 Experimental Setup
SeqSleepNet+ and DeepSleepNet+ were pretrained using the data from the entire 200 subjects of the MASS database (i.e. the source domain) and then finetuned in the target domains. To evaluate the efficiency of transfer learning on sleep staging in the target domains, cross-validation was conducted. Leave-one-out cross-validation was conducted for Sleep-EDF-SC (20 subjects), and Surrey-cEEGrid (12 subjects) while 11-fold cross-validation was performed for Sleep-EDF-ST (22 subjects) to have an equal number of test subjects (i.e. 2 subjects) in each cross-validation fold. At each iteration of cross-validation, a number of subjects were randomly selected and left out for validation purpose, i.e. for early stopping the finetuning process, (4 for Sleep-EDF-SC and Sleep-EDF-ST and 2 for Surrey-cEEGrid). The performance over all cross-validation folds was then calculated.
5.2 Network Parameters
Both SeqSleepNet+ and DeepSleepNet+ were implemented using Tensorflow [59]. The networks were parametrized similar to SeqSleepNet and DeepSleepNet in our previous work [4]. We experimented with the input sequence length epochs as this value is a reasonable choice for these sequence-to-sequence models [4]. The sequences were sampled from the training recordings with a hop size of one epoch for network training and finetuning. During testing, the test sequences were also shifted by one epoch, resulting in an ensemble of classification decisions at each epoch of a test recordings. A probabilistic aggregation step similar to [4] was carried out to fuse the decision ensemble into the final decision.
In the source domain, the networks were pretrained with the MASS database for 10 training epochs with a minibatch size of 32 sequences. For transfer learning, the pretrained networks were further finetuned on each target-domain databases for 10 finetuning epochs. The finetuning process was stopped early when no accuracy improvement was seen on the validation subjects for 50 finetuning steps. Both network training and finetuning were performed using Adam optimizer, an optimization algorithm proposed in [60] for training deep neural networks. This optimizer leverages the power of adaptive learning rates methods to find individual learning rates for each parameter of the network. The initial learning rate of Adam optimizer was set to .
5.3 Experimental Results
5.3.1 Performance on the source domain
It is first worth assessing SeqSleepNet+ and DeepSleepNet+ on the source domain to see how well they perform on a large number of subjects across the input spectrum. To this end, we conducted 10-fold cross-validation on the source domain. At each iteration, 180 subjects were used for training, 10 for validation, and 10 for testing. The results of the cross-validation folds were finally pooled to calculate the overall metrics, including accuracy, macro F1-score, and Cohen’s kappa (). The obtained performance with different inputs are shown in Table 3. Firstly, the results in the table confirm the benefit of using EOG and EMG to complement EEG in the automatic sleep staging task as their presence lead to performance improvement. Secondly, with the sequence-to-sequence framework, the performance obtained by the secondary EOG is just marginally lower than that of the primary EEG, evidenced by both SeqSleepNet+ and DeepSleepNet+. This suggests that EOG can be used as a standalone modality similar to EEG when a single channel is used.
5.3.2 The effect of transfer learning on the target domains
Figures 5 and 6 give an overall picture on the performance obtained by SeqSleepNet+ and DeepSleepNet+ on the target domains with respect to different finetuning strategies and compared to the model trained from scratch using the target-domain data only. The two networks show noticeably varying patterns on the transfer learning results.
On the one hand, SeqSleepNet+’s results in Figure 5 reveal that, while finetuning the softmax layer alone leads to better performance than that of the scratch model in some cases, it is essential to additionally finetune the feature-learning parts of the network, either the EPB for epoch-level feature learning or the SPB for sequence-level feature learning, or both. This pattern exists across all finetuning cases in the figure. This suggests that the features learned by SeqSleepNet+ in the source domain are slightly different from those in the target domain. This is reasonable due to the data mismatch between the source and target domains.
On the other hand, DeepSleepNet+’s finetuning results expose diverging patterns as shown in Figure 6. Finetuning the softmax layer alone results in comparable, or even better, performance than other finetuning strategies in some cases (such as the EEGEEG scenarios) whereas its results are largely belittled in other cases (such as EEGEEG scenarios). This suggests that, when the signals are of the same modality, the features learned from the source domain’s raw signals persist in the target domain and only their combinations need to be adapted in the target domains. In contrast, when the signals are from different modalities, additional finetuning the feature learning parts (i.e. the EPB or the SPB or both) is necessary. It, however, should be emphasized that persistence of the learned features across the source and target domains does not necessarily mean good generalization as DeepSleepNet+’s finetuning results are inferior to those of its counterpart, SeqSleepNet+ (see Table 4).
Despite their different behaviors in finetuning, both SeqSleepNet+ and DeepSleepNet+ meet the transfer learning’s expectation. Compared to the network trained from scratch using the target-domain data only, transfer learning consistently results in improvements across different network types, the target domains, and the transfer learning scenarios. The benefits of transfer learning is further evidenced by contrasting the learning curves of the finetuned models and the scratch models. Taking the two-channel EEGEOGEEGEOG scenario as an example (see Figure 7), the learning curves were recorded on the test data during finetuning and training, respectively. Each learning curve was averaged over all cross-validation folds. As the learning curves’ lengths vary across different folds due to early stopping, those with shorter length than the maximum one were padded to the maximum length before averaging. SeqSleepNet+’s learning curves show better generalization and faster convergence of the finetuned models (except the softmax-only finetuning strategy) compared to their scratch opponents. Similar motifs are observed in DeepSleepNet+’s learning curves; however, the softmax-only finetuning strategy shows a comparable generalization to other strategies (although slower convergence). These findings consolidate the explanation for the finetuning results in Figures 5 and 6.
5.3.3 Performance comparison on the target domains
To justify the necessity of transfer learning, in Table 4 we compare the finetuning overall performance against those of the scratch models and direct transfer (i.e. applying the pretrained models in the target domains without finetuning) across the target domains and the transfer learning scenarios. In addition, the obtained results are also contrasted to those reported in previous works to quantify the efficiency of the proposed transfer learning approach. As the transfer learning results vary depending on the finetuning strategies, for simplicity, out of different finetuning strategies, we retained the SPB+softmax one as the representative for comparison given its consistent finetuning results (see Figures 5 and 6). In practice, the finetuning strategies could be viewed as a hyper-parameter and determined via cross-validation. We should bring to readers’ attention a large body of works, such as [21, 8, 23, 24], that yielded an accuracy level on (extremely) large databases similar to that of our proposed systems. However, comparison to these results is not the main focus of this work; furthermore, such a comparison would be incompatible and, hence, does not offer much meaning.
Between SeqSleepNet+ and DeepSleepNet+, the former outperforms the latter in most of the cases in Table 4. With scratch training, SeqSleepNet+ results in an average accuracy gain of , , and over DeepSleepNet+ on Sleep-EDF-SC, Sleep-EDF-ST, and Surrey-cEEGrid, respectively. This is consistent with the findings from the source domain (i.e. the MASS database) in Table 3 and in [4]. With transfer learning, SeqSleepNet+ also obtains better performance than DeepSleepNet+ with, improving the overall accuracy by , , and on Sleep-EDF-SC, Sleep-EDF-ST, and Surrey-cEEGrid, respectively. These results suggest that DeepSleepNet+ is harder to train and finetune than SeqSleepNet+, especially when the data is small, partly due to its large model footprint [6] and partly due to its reliance on raw signal inputs. However, the results in Table 4 show significant gains obtained by both the finetuned models over their scratch counterparts. On the one hand, averaging over all transfer learning scenarios, finetuning SeqSleepNet+ leads to an absolute accuracy gain of , , and on Sleep-EDF-SC, Sleep-EDF-ST, and Surrey-cEEGrid, respectively. Those gains of DeepSleepNet+ are even larger, reaching , , and , respectively, mainly because of the poor performance of the scratch DeepSleepNet+ on Sleep-EDF-ST and Surrey-cEEGrid. Interestingly, transfer learning helps compensate for the lack of training data, evidenced by the observation that the accuracy on Sleep-EDF-SC achieved by the finetuned SeqSleepNet+ is on par with that of MASS (cf. Table 3) even though the number of subjects is ten times smaller. On the other hand, despite the heavy data mismatch in the cross-domain scenario, transferring the information of EEG data in the source domain to EOG data in the target domains still yields significant accuracy gains: and on average with SeqSleepNet+ and DeepSleepNet+, respectively. Interestingly, with the accuracy consistently around obtained from the secondary EOG via DeepSleepNet+’s transfer learning, it is promising to be used as an alternative for EEG in single-channel sleep staging.
Directly applying the pretrained models in the target domains without finetuning results in suboptimal performance in many cases. Averaging over the same-modality transfer learning scenarios, the pretrained SeqSleepNet+ model with direct transfer obtains an accuracy with , , and lower than those obtained by the finetuned models on Sleep-EDF-SC, Sleep-EDF-ST, and Surrey-cEEGrid, respectively. Those gaps in case of DeepSleepNet+ are , , and , respectively. The direct transfer’s results are particularly poor under heavy data mismatch conditions, such as the EEGEOG scenario and the EEGEEG scenario in Surrey-cEEGrid. It is reasonable as substantial differences in characteristics of the source domain and the target domain cause discrepancy in the feature-learning parts of the pretrained models in the target domain. As a consequence, finetuning is essential. Similar findings are also reflected in the class-wise performance (in terms of MF1) in Table 5.
The proposed transfer learning approach also outperforms all previous works and set state-of-the-art performance on all three target databases. On Sleep-EDF-SC, with the accuracies of (two-channel EEGEOG) and (single-channel EEG) obtained by the transfer learning based SeqSleepNet+, the system yields absolute accuracy gains of and over the best non-transfer-learning systems, Multitask 1-max CNN [5] () and DeepSleepNet [6] (), respectively. Those respective gains achieved by the transfer learning based DeepSleepNet+ are and . Large margins, and , are seen when contrasting the proposed SeqSleepNet+ and DeepSleepNet+ systems with the existing transfer learning approach based on ResNet [37] and VGGNet [18]. These results suggest that the quality of the base model plays an important role in transfer learning for sleep staging. The results obtained by the proposed systems are also better than the personalization results in [9] even though cohort transfer learning here is more challenging than personalized transfer learning as, with the former, we do not have access to test subjects’ data during training. Similar to Sleep-EDF-SC, both proposed systems are superior to previous works on Sleep-EDF-ST. However, on Surrey-cEEGrid, while the transfer learning based SeqSleepNet+ uplifts the accuracy by a margin of in two-channel EEGEOG and in single-channel EEG compared to the seminal work in [11], the DeepSleepNet+ experiences an accuracy drop of in single-channel EEG even though absolute accuracy gain is seen in two-channel EEGEOG.
5.3.4 Influence of the number of finetuning subjects
This section investigates the influence of the amount of the target-domain data to the network finetuning. Considering the EEGEOGEEGEOG scenario and the entire-network finetuning strategies for this investigation. For a target domain, we randomly selected 25% of the subjects as the test subjects while the remaining subjects were used for finetuning. A pretrained network was finetuned using data from the finetuning set of subjects for 500 finetuning steps and the test accuracy was recorded during the finetuning process. Starting with the finetuning set of subject, we repeated this procedure and added two more subjects into it at each iteration.
Figure 8 shows the learning curves recorded with varying number of finetuning subjects. The learning curves present a strong impact of the number of finetuning subjects on SeqSleepNet+ while such influence on DeepSleepNet+ is less noticeable, except for Surrey-cEEGrid. It is rational if these results are linked to the networks’ finetuning behaviors. While a pretrained SeqSleepNet+ requires its feature-learning parts to be adapted into the target domains, this requirement is not mandatory for DeepSleepNet+, except for the cEEGrid data (see Section 5.3.2). And when the feature-learning parts need to be adjusted, less finetuning data make the networks converge to more subject-specific solutions, i.e. overfitting. On the contrary, more finetuning data allow the feature learning parts to converge to more generalizable solutions. This is supported by the SeqSleepNet+’s learning curves on the Sleep-EDF-SC and Surrey-cEEGrid domain, and DeepSleepNet+’s learning curves on the Surrey-cEEGrid domain. From these curves, we also speculate that when the feature-learning parts of a network needs to be adapted to a target domain, a generalizable solution can be obtained with the number of finetuning subjects being around 11-13. Particularly, the learning curves on Sleep-EDF-ST appears to be counter-intuitive as more finetuning subjects occasionally result in lowering learning curves. These irregularities can be explained by the fact that the Sleep-EDF-ST population has a very wide range of age, 18-79. As sleep patterns change with age [68], depending the age range of the test subjects, including a subject whose age is far from that range would hurt more than help. Further studies how to determine and select candidates from a population that are most beneficial for a finetuning task.
5.4 Discussion
It is worth mentioning that, although we focused on studying with small cohorts in this work, the presented transfer learning approach would also be useful for a sleep study with a larger cohort. On the one hand, it only requires the data of a handful of subjects to be labelled, avoiding the burden of manual scoring the entire cohort. On the other hand, finetuning a pretrained model is generally much faster than training a model from scratch, as illustrated in Figure 7. This is because the pretrained model has reached already a reasonable accuracy. As a result, it is able to converge after a few additional finetuning epochs. On the downside, it is worth noting that still data from a number of subjects is needed for the validation purpose and future works should explore regularization methods, such as Kullback–Leibler divergence [69], to eliminate this requirement.
6 Conclusion
We presented a deep transfer learning approach to address the problem of insufficient data in many sleep studies and to improve automatic sleep staging performance on small cohorts. The SeqSleepNet+ and DeepSleepNet+ derived from the presented generic sequence-to-sequence sleep staging framework were employed to surpass data mismatch and enable transferring information from the source domain to the target domain. The networks were trained in the source domain and then finetuned in the target domains to complete knowledge transfer. Experiments were conducted with different finetuning strategies, transfer learning scenarios, and target domains. The experimental results showed that via transfer learning, the sleep staging performance was significantly improved across all learning cases over the scratch models trained solely on the target domains. The results also revealed the different behaviors of two SeqSleepNet+ and DeepSleepNet+ models in transfer learning. The former was found more consistent and stable and outperformed the latter in most of the transfer learning experiments. The number of subjects required for finetuning also varied between the two networks, however, overall, a small number of finetuning subjects was needed for the networks to converge to a generalizable solution.
Acknowledgment
This research received funding from the Flemish Government (AI Research Program). Maarten De Vos is affiliated to Leuven.AI - KU Leuven institute for AI, B-3000, Leuven, Belgium. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Titan V GPU used for this research. We would like to thank Dr. Kaare Mikkelsen for sharing the Surrey-cEEGrid database.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] C. Iber et al. , “The AASM manual for the scoring of sleep and associated events: Rules, terminology and technical specifications,” American Academy of Sleep Medicine , 2007.
- 2[2] J. A. Hobson, “A manual of standardized terminology, techniques and scoring system for sleep stages of human subjects,” Electroencephalography and Clinical Neurophysiology , vol. 26, no. 6, pp. 644, 1969.
- 3[3] S. J. Redmond and C. Heneghan, “Cardiorespiratory-based sleep staging in subjects with obstructive sleep apnea,” IEEE Trans Biomed Eng , vol. 53, pp. 485–496, 2006.
- 4[4] H. Phan et al. , “Seq Sleep Net: end-to-end hierarchical recurrent neural network for sequence-to-sequence automatic sleep staging,” IEEE Trans Neural Syst Rehabil Eng , vol. 27, no. 3, pp. 400–410, 2019.
- 5[5] H. Phan et al. , “Joint classification and prediction CNN framework for automatic sleep stage classification,” IEEE Trans Biomed Eng , vol. 66, no. 5, pp. 1285–1296, 2019.
- 6[6] A. Supratak et al. , “Deep Sleep Net: A model for automatic sleep stage scoring based on raw single-channel EEG,” IEEE Trans Neural Syst Rehabil Eng , vol. 25, no. 11, pp. 1998–2008, 2017.
- 7[7] O. Tsinalis et al. , “Automatic sleep stage scoring with single-channel EEG using convolutional neural networks,” ar Xiv:1610.01683 , 2016.
- 8[8] J. B. Stephansen et al. , “Neural network analysis of sleep stages enables efficient diagnosis of narcolepsy,” Nat. Commun. , vol. 9, no. 1, 2018.
