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