| Literature DB >> 33841068 |
Alexander Malafeev1,2, Anneke Hertig-Godeschalk3, David R Schreier3, Jelena Skorucak1,2, Johannes Mathis3, Peter Achermann1,2,4,5.
Abstract
Brief fragments of sleep shorter than 15 s are defined as microsleep episodes (MSEs), often subjectively perceived as sleepiness. Their main characteristic is a slowing in frequency in the electroencephalogram (EEG), similar to stage N1 sleep according to standard criteria. The maintenance of wakefulness test (MWT) is often used in a clinical setting to assess vigilance. Scoring of the MWT in most sleep-wake centers is limited to classical definition of sleep (30 s epochs), and MSEs are mostly not considered in the absence of established scoring criteria defining MSEs but also because of the laborious work. We aimed for automatic detection of MSEs with machine learning, i.e., with deep learning based on raw EEG and EOG data as input. We analyzed MWT data of 76 patients. Experts visually scored wakefulness, and according to recently developed scoring criteria MSEs, microsleep episode candidates (MSEc), and episodes of drowsiness (ED). We implemented segmentation algorithms based on convolutional neural networks (CNNs) and a combination of a CNN with a long-short term memory (LSTM) network. A LSTM network is a type of a recurrent neural network which has a memory for past events and takes them into account. Data of 53 patients were used for training of the classifiers, 12 for validation and 11 for testing. Our algorithms showed a good performance close to human experts. The detection was very good for wakefulness and MSEs and poor for MSEc and ED, similar to the low inter-expert reliability for these borderline segments. We performed a visualization of the internal representation of the data by the artificial neuronal network performing best using t-distributed stochastic neighbor embedding (t-SNE). Visualization revealed that MSEs and wakefulness were mostly separable, though not entirely, and MSEc and ED largely intersected with the two main classes. We provide a proof of principle that it is feasible to reliably detect MSEs with deep neuronal networks based on raw EEG and EOG data with a performance close to that of human experts. The code of the algorithms (https://github.com/alexander-malafeev/microsleep-detection) and data (https://zenodo.org/record/3251716) are available.Entities:
Keywords: deep learning; drowsiness; excessive daytime sleepiness; machine learning; microsleep episodes
Year: 2021 PMID: 33841068 PMCID: PMC8024556 DOI: 10.3389/fnins.2021.564098
Source DB: PubMed Journal: Front Neurosci ISSN: 1662-453X Impact factor: 4.677
Demographics, diagnosis and fraction of time spent in the four stages of patients contributing to the training, validation, and test set: total number of patients (N), number of males/females, mean age and standard deviation, number of patients with a suspected diagnosis of sleep apnea, idiopathic hypersomnia, non-organic hypersomnia, narcolepsy, insomnia, EDS with unclear cause, excessive tiredness, and others, and the fraction of time spent in wake, MSEs, MSEc, and ED.
| Training | Validation | Testing | |
| N | 53 | 12 | 11 |
| Male/Female | 35/18 | 6/6 | 9/2 |
| Age (mean ± SD years) | 45.99 ± 18.17 | 44.64 ± 20.56 | 44.92 ± 14.48 |
| Sleep apnea | 20 | 0 | 3 |
| Idiopathic hypersomnia | 2 | 1 | 1 |
| Non-organic hypersomnia | 1 | 0 | 0 |
| Narcolepsy | 4 | 1 | 1 |
| Insomnia | 1 | 0 | 0 |
| EDS with unclear cause | 18 | 4 | 4 |
| Excessive tiredness | 2 | 3 | 2 |
| Others | 5 | 3 | 0 |
| Fraction of time in | |||
| Wake | 0.89 | 0.85 | 0.91 |
| MSEs | 0.08 | 0.09 | 0.05 |
| MSEc | 0.01 | 0.01 | 0.01 |
| ED | 0.02 | 0.05 | 0.03 |
FIGURE 1Illustration of the idea behind the segmentation (classification) with a CNN (A) and CNN-LSTM (B) network. A sliding window was used in the case of CNN only networks. Microsleep episodes were inferred corresponding to the middle of the window on every step (sampling resolution). In case of CNN-LSTM network a sequence of overlapping windows (classified by a CNN) with the stride of 0.25 s inferring microsleep corresponding to the middle window in the sequence (LSTM classification). Thus, the resulting resolution of the detection was 0.25 s. Green bars: scored MSEs; red bar in (A) classified MSE; red and blue squares in (B) classification of a sample or window.
FIGURE 2Structure of the CNN (A) and the CNN-LSTM (B) networks. Input is on top, output at the bottom. Since we applied several configurations of the CNN networks the repetitions of the last convolutional and pooling blocks were different. The number of channels in the input may differ for the networks using either an EEG and two EOG channels or a single EEG channel only. See sections “Architecture of the Networks” and “Materials and Methods” and Table 2 for the description of the different layers.
Description of the different layers and notions used in the architecture of the networks (Figure 2).
| Layers | Description |
| Convolution, N 3 × 1 filters; strides 1 × 1 | Convolutional layer ( |
| BatchNorm | Batch normalization is a way to speed up training and regularize the network ( |
| ReLU | Rectified linear unit ( |
| Max-pooling; pool_size 2 × 1 | Max-pooling layer ( |
| Flatten | Layer which resizes the input tensor and produces a one-dimensional vector with the same number of elements |
| Dropout (p = q) | Dropout layer ( |
| Dense (N = n) | Densely connected layer with n neurons |
| Softmax (N = n) | Densely connected layer with n neurons and a special activation function which produces a probability distribution with n values ( |
| LSTM (N = n) | Long short-term memory layer ( |
FIGURE 3Expert (top) and automatic soring with one algorithm (CNN with 16-s window; bottom) of an MWT (40 min) in one patient of the validation set (patient y5We). A good match between the algorithm and an expert scoring for wakefulness (W) and microsleep episodes (MSE) are evident, but a poor match for episodes of drowsiness (ED) and microsleep episode candidates (MSEc). Scoring was performed with the resolution of one sample; for the illustration, we coarsened the result to a resolution of 0.5 s (100 samples), i.e., the most frequent class within an interval was plotted. Results for other patients of the validation set are illustrated in Supplementary Figure S1, those of the test set in Supplementary Figure S2.
FIGURE 4Cohen’s kappa of different algorithms along with the agreement between two experts. W, wakefulness; MSE, microsleep episodes; MSEc, microsleep candidates; ED, episodes of drowsiness. Experts: agreement between two experts computed based on five recordings containing MSEs. 2–16s: comparison between one expert and convolutional neural networks (CNNs) with window lengths 2, 4, 8, and 16 s. 16s_u: CNN with a 16s window and uniformly weighted classes. 16s_1c: CNN with 16s window and only one EEG channel as input. 32s: CNN with a 32s window. CNN_LSTM: CNN combined with a long-short term memory (LSTM) architecture; it has only two classes because this network was trained to detect only MSEs, everything else was considered as wakefulness. If not mentioned otherwise, one occipital EEG channel and two ocular channels served as input for the networks. Kappa of the neural networks was computed using the validation dataset (12 recordings). The data of all recordings were concatenated to estimate the overall kappa.
Cohen’s kappa computed on the validation dataset (n = 12) using different network architectures.
| W | MSE | MSEc | ED | |
| Experts | 0.71 | 0.80 | 0.09 | 0.06 |
| 2s | 0.58 | 0.61 | 0.02 | 0.05 |
| 4s | 0.62 | 0.65 | 0.03 | 0.07 |
| 8s | 0.63 | 0.67 | 0.07 | 0.11 |
| 16s | 0.67 | 0.69 | 0.04 | 0.06 |
| 16s_u | 0.67 | 0.69 | 0.03 | 0.07 |
| 16s_1c | 0.58 | 0.64 | 0.03 | 0.02 |
| 32s | 0.66 | 0.69 | 0.02 | 0.07 |
| CNN_LSTM | 0.65 | 0.65 |
FIGURE 5T-distributed stochastic neighbor embedding (t-SNE) was used to illustrate the data and their classification mapped into a 2D space (last layer of the CNN 16s; arbitrary units). (A) Mapping of training data (patient Nzhl). All stages form clearly separated clusters except for very few data points as expected for the training data of artificial neural networks. (B) Mapping of validation data (patient y5We; same data as in Figure 3). Basically, two large clusters corresponding to W and MSE are visible which do not completely separate. MSEc and ED do not form clusters and are not separable from W and MSE. Thus, it illustrates why our algorithms could not score MSEc and ED reliably. Wakefulness (W): blue; microsleep episodes (MSE): red; microsleep episode candidates (MSEc) green; episodes of drowsiness (ED): magenta. For the convenience we illustrated only every hundredth datapoint (sample). Please note that this figure only shows the internal representation of the data in this specific network. Further data are illustrated in supporting information, for training and validation separately (Supplementary Figures S3, S4).