|
a |
|
b/README.md |
|
|
1 |
# SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach |
|
|
2 |
In this study, we introduced a novel deep learning approach, called SleepEEGNet, for automated sleep stage scoring using a single-channel EEG. |
|
|
3 |
|
|
|
4 |
# Paper |
|
|
5 |
Our paper can be downloaded from the [arxiv website](https://arxiv.org/pdf/1903.02108). |
|
|
6 |
* The Model architecture |
|
|
7 |
 |
|
|
8 |
|
|
|
9 |
* The CNN architecture |
|
|
10 |
|
|
|
11 |
 |
|
|
12 |
|
|
|
13 |
## Requirements |
|
|
14 |
* Python 2.7 |
|
|
15 |
* tensorflow/tensorflow-gpu |
|
|
16 |
* numpy |
|
|
17 |
* scipy |
|
|
18 |
* matplotlib |
|
|
19 |
* scikit-learn |
|
|
20 |
* matplotlib |
|
|
21 |
* imbalanced-learn(0.4.3) |
|
|
22 |
* pandas |
|
|
23 |
* mne |
|
|
24 |
## Dataset and Data Preparation |
|
|
25 |
We evaluated our model using [the Physionet Sleep-EDF datasets](https://physionet.org/physiobank/database/sleep-edfx/) published in 2013 and 2018. |
|
|
26 |
We have used the source code provided by [github:akaraspt](https://github.com/akaraspt/deepsleepnet) to prepare the dataset. |
|
|
27 |
|
|
|
28 |
* To download SC subjects from the Sleep_EDF (2013) dataset, use the below script: |
|
|
29 |
|
|
|
30 |
``` |
|
|
31 |
cd data_2013 |
|
|
32 |
chmod +x download_physionet.sh |
|
|
33 |
./download_physionet.sh |
|
|
34 |
``` |
|
|
35 |
|
|
|
36 |
* To download SC subjects from the Sleep_EDF (2018) dataset, use the below script: |
|
|
37 |
``` |
|
|
38 |
cd data_2018 |
|
|
39 |
chmod +x download_physionet.sh |
|
|
40 |
./download_physionet.sh |
|
|
41 |
``` |
|
|
42 |
|
|
|
43 |
Use below scripts to extract sleep stages from the specific EEG channels of the Sleep_EDF (2013) dataset: |
|
|
44 |
|
|
|
45 |
``` |
|
|
46 |
python prepare_physionet.py --data_dir data_2013 --output_dir data_2013/eeg_fpz_cz --select_ch 'EEG Fpz-Cz' |
|
|
47 |
python prepare_physionet.py --data_dir data_2013 --output_dir data_2013/eeg_pz_oz --select_ch 'EEG Pz-Oz' |
|
|
48 |
``` |
|
|
49 |
|
|
|
50 |
## Train |
|
|
51 |
|
|
|
52 |
* Modify args settings in seq2seq_sleep_sleep-EDF.py for each dataset. |
|
|
53 |
|
|
|
54 |
* For example, run the below script to train SleepEEGNET model with the 20-fold cross-validation using Fpz-Cz channel of the Sleep_EDF (2013) dataset: |
|
|
55 |
``` |
|
|
56 |
python seq2seq_sleep_sleep-EDF.py --data_dir data_2013/eeg_fpz_cz --output_dir output_2013 --num_folds 20 |
|
|
57 |
``` |
|
|
58 |
|
|
|
59 |
## Results |
|
|
60 |
* Run the below script to present the achieved results by SleepEEGNet model for Fpz-Cz channel. |
|
|
61 |
``` |
|
|
62 |
python summary.py --data_dir output_2013/eeg_fpz_cz |
|
|
63 |
``` |
|
|
64 |
|
|
|
65 |
 |
|
|
66 |
|
|
|
67 |
## Visualization |
|
|
68 |
* Run the below script to visualize attention maps of a sequence input (EEG epochs) for Fpz-Cz channel. |
|
|
69 |
``` |
|
|
70 |
python visualize.py --data_dir output_2013/eeg_fpz_cz |
|
|
71 |
``` |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
## Citation |
|
|
75 |
|
|
|
76 |
If you find it useful, please cite our paper as follows: |
|
|
77 |
|
|
|
78 |
``` |
|
|
79 |
@article{mousavi2019sleepEEGnet, |
|
|
80 |
title={SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach}, |
|
|
81 |
author={Sajad Mousavi, Fatemeh Afghah and U. Rajendra Acharya}, |
|
|
82 |
journal={arXiv preprint arXiv:1903.02108}, |
|
|
83 |
year={2019} |
|
|
84 |
} |
|
|
85 |
``` |
|
|
86 |
|
|
|
87 |
## References |
|
|
88 |
[github:akaraspt](https://github.com/akaraspt/deepsleepnet) |
|
|
89 |
[deepschool.io](https://github.com/sachinruk/deepschool.io/blob/master/DL-Keras_Tensorflow) |
|
|
90 |
|
|
|
91 |
## Licence |
|
|
92 |
For academtic and non-commercial usage |