All Projects → akaraspt → Deepsleepnet

akaraspt / Deepsleepnet

Licence: apache-2.0
DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Deepsleepnet

Awesome Deep Learning Resources
Rough list of my favorite deep learning resources, useful for revisiting topics or for reference. I have got through all of the content listed there, carefully. - Guillaume Chevalier
Stars: ✭ 1,469 (+634.5%)
Mutual labels:  cnn, lstm
Easyocr
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
Stars: ✭ 13,379 (+6589.5%)
Mutual labels:  cnn, lstm
Deeplearning tutorials
The deeplearning algorithms implemented by tensorflow
Stars: ✭ 1,580 (+690%)
Mutual labels:  cnn, lstm
Pytorch Pos Tagging
A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.
Stars: ✭ 96 (-52%)
Mutual labels:  cnn, lstm
Eeg Dl
A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.
Stars: ✭ 165 (-17.5%)
Mutual labels:  cnn, lstm
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-51.5%)
Mutual labels:  cnn, lstm
Pytorch convlstm
convolutional lstm implementation in pytorch
Stars: ✭ 126 (-37%)
Mutual labels:  cnn, lstm
Deepzip
NN based lossless compression
Stars: ✭ 69 (-65.5%)
Mutual labels:  cnn, lstm
Tensorflow template application
TensorFlow template application for deep learning
Stars: ✭ 1,851 (+825.5%)
Mutual labels:  cnn, lstm
Vpilot
Scripts and tools to easily communicate with DeepGTAV. In the future a self-driving agent will be implemented.
Stars: ✭ 136 (-32%)
Mutual labels:  cnn, lstm
Cnn lstm for text classify
CNN, LSTM, NBOW, fasttext 中文文本分类
Stars: ✭ 90 (-55%)
Mutual labels:  cnn, lstm
Speech Emotion Recognition
Speech emotion recognition implemented in Keras (LSTM, CNN, SVM, MLP) | 语音情感识别
Stars: ✭ 181 (-9.5%)
Mutual labels:  cnn, lstm
End To End Sequence Labeling Via Bi Directional Lstm Cnns Crf Tutorial
Tutorial for End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF
Stars: ✭ 87 (-56.5%)
Mutual labels:  cnn, lstm
Sarcasmdetection
Sarcasm detection on tweets using neural network
Stars: ✭ 99 (-50.5%)
Mutual labels:  cnn, lstm
Sleepeegnet
SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach
Stars: ✭ 89 (-55.5%)
Mutual labels:  cnn, eeg
Robust Lane Detection
Stars: ✭ 110 (-45%)
Mutual labels:  cnn, lstm
Lstm Context Embeddings
Augmenting word embeddings with their surrounding context using bidirectional RNN
Stars: ✭ 57 (-71.5%)
Mutual labels:  cnn, lstm
Lstm Cnn classification
Stars: ✭ 64 (-68%)
Mutual labels:  cnn, lstm
Ncrfpp
NCRF++, a Neural Sequence Labeling Toolkit. Easy use to any sequence labeling tasks (e.g. NER, POS, Segmentation). It includes character LSTM/CNN, word LSTM/CNN and softmax/CRF components.
Stars: ✭ 1,767 (+783.5%)
Mutual labels:  cnn, lstm
Kaggle Competition Favorita
5th place solution for Kaggle competition Favorita Grocery Sales Forecasting
Stars: ✭ 169 (-15.5%)
Mutual labels:  cnn, lstm

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].