Skip to content
프로젝트

소개

DeepSleepNet: 원시 단일 채널 EEG를 기반으로 수면 단계를 자동으로 판정하는 모델

AI 및 머신러닝

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+3
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

DeepSleepNet

A deep learning model for automatic sleep stage scoring based on raw, single-channel EEG.

We have published a more efficient deep learning model, named TinySleepNet, which is much smaller and can achieve a better scoring performance.

TinySleepNet: An Efficient Deep Learning Model for Sleep Stage Scoring based on Raw Single-Channel EEG by Akara Supratak and Yike Guo from The Faculty of ICT, Mahidol University and Imperial College London respectively. [paper][github]

Code for the model in the paper DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG by Akara Supratak, Hao Dong, Chao Wu, Yike Guo from Data Science Institute, Imperial College London.

This work has been accepted for publication in IEEE Transactions on Neural Systems and Rehabilitation Engineering.

You can also find our accepted version before the publication in arXiv.

The architecture of DeepSleepNet: DeepSleepNet Note: Fs is the sampling rate of the input EEG signals

This figure illustrates one interpretable LSTM cell from the model, which learn to keep track when each subject is awake (i.e., in W stage): Sleep Onset Cell

Environment

The following setup has been used to reproduce this work:

  • Ubuntu 18.04 / Windows 10 1903 x64
  • CUDA toolkit 10.0 and CuDNN v7.6.4
  • Python 3.5.4 x64
  • tensorflow-gpu (1.15.2)
  • matplotlib (1.5.3)
  • scikit-learn (0.19.1)
  • scipy (1.4.1)
  • numpy (1.18.2)
  • pandas (0.25.3)
  • mne (0.20.0)
  • tensorlayer (optional)
  • MongoDB (optional)
  • eAE (optional)

Prepare dataset

We evaluated our DeepSleepNet with MASS and Sleep-EDF dataset.

For the MASS dataset, you have to request for a permission to access their dataset. For the Sleep-EDF dataset, you can run the following scripts to download SC subjects.

cd data
chmod +x download_physionet.sh
./download_physionet.sh

Then run the following script to extract specified EEG channels and their corresponding sleep stages.

python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch 'EEG Fpz-Cz'
python prepare_physionet.py --data_dir data --output_dir data/eeg_pz_oz --select_ch 'EEG Pz-Oz'

Training a model

Run this script to train a DeepSleepNet model for the first fold of the 20-fold cross-validation.

python train.py --data_dir data/eeg_fpz_cz --output_dir output --n_folds 20 --fold_idx 0 --pretrain_epochs 100 --finetune_epochs 200 --resume False

You need to train a DeepSleep model for every fold (i.e., fold_idx=0...19) before you can evaluate the performance. You can use the following script to run batch training

chmod +x batch_train.sh
./batch_train.sh data/eeg_fpz_cz/ output 20 0 19 0

Scoring sleep stages

Run this script to determine the sleep stages for the withheld subject for each cross-validation fold.

python predict.py --data_dir data/eeg_fpz_cz --model_dir output --output_dir output

The output will be stored in numpy files.

Get a summary

Run this script to show a summary of the performance of our DeepSleepNet compared with the state-of-the-art hand-engineering approaches. The performance metrics are overall accuracy, per-class F1-score, and macro F1-score.

python summary.py --data_dir output

Submit the job to the eAE cluster equipped with TensorLayer

  1. Setup an eAE cluster (follows the instruction in this link)
  2. Setup a MongoDB
  3. Change location of MongoDB in deepsleep/trainer.py
  4. Modify submit_eAE.py
  5. Run python submit_eAE.py

ToDo

  • Release a version that does not depend on MongoDB and Tensorlayer (easier to install, but could take longer time for training).

Citation

If you find this useful, please cite our work as follows:

@article{Supratak2017,
    title = {DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG},
    author = {Supratak, Akara and Dong, Hao and Wu, Chao and Guo, Yike},
    journal = {IEEE Transactions on Neural Systems and Rehabilitation Engineering},
    year = {2017},
    month = {Nov},
    volume = {25}, 
    number = {11}, 
    pages = {1998-2008}, 
    doi = {10.1109/TNSRE.2017.2721116}, 
    ISSN = {1534-4320}, 
}

Licence

  • For academic and non-commercial use only
  • Apache License 2.0

관련 프로젝트 살펴보기

불러오는 중…