| Literature DB >> 32532084 |
Tianqi Zhu1, Wei Luo1, Feng Yu1.
Abstract
Analyzing polysomnography (PSG) is an effective method for evaluating sleep health; however, the sleep stage scoring required for PSG analysis is a time-consuming effort for an experienced medical expert. When scoring sleep epochs, experts pay attention to find specific signal characteristics (e.g., K-complexes and spindles), and sometimes need to integrate information from preceding and subsequent epochs in order to make a decision. To imitate this process and to build a more interpretable deep learning model, we propose a neural network based on a convolutional network (CNN) and attention mechanism to perform automatic sleep staging. The CNN learns local signal characteristics, and the attention mechanism excels in learning inter- and intra-epoch features. In experiments on the public sleep-edf and sleep-edfx databases with different training and testing set partitioning methods, our model achieved overall accuracies of 93.7% and 82.8%, and macro-average F1-scores of 84.5 and 77.8, respectively, outperforming recently reported machine learning-based methods.Entities:
Keywords: attention mechanism; convolutional neural network; sleep stage classification
Mesh:
Year: 2020 PMID: 32532084 PMCID: PMC7313068 DOI: 10.3390/ijerph17114152
Source DB: PubMed Journal: Int J Environ Res Public Health ISSN: 1660-4601 Impact factor: 3.390
Figure 1Examples of the characteristic electroencephalogram (EEG) signal features of sleep stages (from top to bottom): stage N1 with low amplitude mixed frequency (LAMF) and vertex sharp waves; stage N2 with K-complexes; stage N3 with slow waves; and rapid eye movement (REM) sleep stage with saw-tooth waves.
Number of epochs of each stage in the datasets after processing.
| Dataset | W | N1 | N2 | N3 | REM | Total |
|---|---|---|---|---|---|---|
| Sleep-edfx | 8246 | 2804 | 17,799 | 5703 | 7717 | 42,269 |
| Sleep-edf | 8055 | 604 | 3621 | 1299 | 1609 | 15,188 |
Figure 2EEG signal amplitude distribution: (a) raw data; (b) normalized data.
Figure 3Two training and testing set partitioning methods: (a) subject-wise; (b) epoch-wise.
Figure 4Model architecture: (a) whole model; (b) window feature learning; (c) attention block.
Convolutional layer parameters in the window feature learning component.
| Module | Number of Filters | Kernel Size | Stride | Output Shape |
|---|---|---|---|---|
| Input | - | - | - | (200, 1) |
| Conv_1 | 64 | 5 | 3 | (66, 64) |
| Conv_2 | 64 | 5 | 3 | (21, 64) |
| Conv_3 | 128 | 3 | 2 | (10, 128) |
| Conv_4 | 128 | 3 | 1 | (8, 128) |
| Conv_5 | 256 | 3 | 1 | (6, 256) |
| GAP | - | - | - | (1, 256) |
Confusion matrix and overall performance on the sleep-edf dataset.
| Stage | Predictions | Per-Class Metrics | ||||||
|---|---|---|---|---|---|---|---|---|
| Wake | N1 | N2 | N3 | REM | Precision | Recall | F1 | |
| W | 2388 | 33 | 6 | 1 | 5 | 99.1 | 98.2 | 98.6 |
| N1 | 15 | 83 | 25 | 1 | 35 | 52.9 | 52.2 | 52.5 |
| N2 | 2 | 28 | 1024 | 49 | 16 | 92.7 | 91.5 | 92.1 |
| N3 | 2 | 0 | 44 | 336 | 1 | 86.8 | 87.7 | 87.3 |
| REM | 2 | 13 | 6 | 0 | 437 | 88.5 | 95.4 | 91.8 |
Overall accuracy: 93.7%, MF1 score: 84.5.
Confusion matrix and overall performance on the sleep-edfx dataset.
| Stage | Predictions | Per-Class Metrics | ||||||
|---|---|---|---|---|---|---|---|---|
| W | N1 | N2 | N3 | REM | Precision | Recall | F1 | |
| W | 7287 | 586 | 89 | 57 | 149 | 91.5 | 89.2 | 90.3 |
| N1 | 279 | 1497 | 434 | 24 | 570 | 42.1 | 53.4 | 47.1 |
| N2 | 259 | 846 | 14,596 | 1388 | 710 | 90.5 | 82.1 | 86.0 |
| N3 | 39 | 31 | 586 | 5042 | 5 | 76.6 | 88.4 | 82.1 |
| REM | 103 | 598 | 422 | 69 | 6525 | 82.0 | 84.6 | 83.2 |
Overall accuracy: 82.8%, MF1 score: 77.8.
Figure 5Manually labeled and predicted hypnogram of subject 6 on the first night in the sleep-edfx database.
Figure 6Attention weights visualization of different stages. The blue line is the raw EEG signal and the red line is the corresponding attention weights: (a) stage N2; (b) stage N3; (c) REM stage.
Performance of different combinations of model components.
| Window Feature | Intra-Epoch Attention | Inter-Epoch Attention | Weighted Loss Function | Overall Performance | |||
|---|---|---|---|---|---|---|---|
| Subject-Wise | Epoch-Wise | ||||||
| Accuracy | MF1 | Accuracy | MF1 | ||||
| √ | √ | √ | √ | 82.8 | 77.8 | 93.7 | 84.5 |
| × | √ | √ | √ | 76.7 | 70.5 | 83.5 | 68.2 |
| √ | × | √ | √ | 81.3 | 76.3 | 92.3 | 82.2 |
| √ | √ | × | √ | 82.0 | 76.9 | 93.1 | 83.7 |
| √ | √ | √ | × | 82.8 | 75.8 |
| 84.1 |
Performance of different methods on the sleep-edf and sleep-edfx datasets.
| Methods | Samples | Per-Class F1-Score | Overall Performances | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Wake | N1 | N2 | N3 | REM | Accuracy | MF1 | |||
|
| Ref. [ | 37,022 | 71.6 | 47.0 | 84.6 | 84.0 | 81.4 | 78.9 | 73.7 |
| Ref. [ | 37,022 | 65.4 | 43.7 | 80.6 | 84.9 | 74.5 | 74.9 | 69.8 | |
| Ref. [ | 41,950 | 84.7 | 46.6 | 85.9 | 84.8 | 82.4 | 82.0 | 76.9 | |
| Ref. [ | 46,236 | 89.8 | 33.2 | 86.7 | 86.0 | 82.6 | 82.6 | 74.2 | |
| Proposed | 42,269 | 90.3 | 47.1 | 86.0 | 82.1 | 83.2 | 82.8 | 77.8 | |
|
| Ref. [ | 15,188 | 96.9 | 49.1 | 88.9 | 84.2 | 81.2 | 90.8 | 80.1 |
| Ref. [ | 15,136 | 97.8 | 30.4 | 89.0 | 85.5 | 82.5 | 91.3 | 77.0 | |
| Ref. [ | 15,188 | 97.5 | 24.8 | 89.4 | 87.0 | 80.8 | 91.2 | 75.9 | |
| Proposed | 15,188 | 98.6 | 52.5 | 92.1 | 87.2 | 91.8 | 93.7 | 84.5 | |