All Projects → emadeldeen24 → AttnSleep

emadeldeen24 / AttnSleep

Licence: MIT license
[IEEE TNSRE] "An Attention-based Deep Learning Approach for Sleep Stage Classification with Single-Channel EEG"

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to AttnSleep

eeg-gcnn
Resources for the paper titled "EEG-GCNN: Augmenting Electroencephalogram-based Neurological Disease Diagnosis using a Domain-guided Graph Convolutional Neural Network". Accepted for publication (with an oral spotlight!) at ML4H Workshop, NeurIPS 2020.
Stars: ✭ 50 (-34.21%)
Mutual labels:  eeg, eeg-classification
CrabNet
Predict materials properties using only the composition information!
Stars: ✭ 57 (-25%)
Mutual labels:  attention, self-attention
EEG-Motor-Imagery-Classification-CNNs-TensorFlow
EEG Motor Imagery Tasks Classification (by Channels) via Convolutional Neural Networks (CNNs) based on TensorFlow
Stars: ✭ 125 (+64.47%)
Mutual labels:  eeg, eeg-classification
iPerceive
Applying Common-Sense Reasoning to Multi-Modal Dense Video Captioning and Video Question Answering | Python3 | PyTorch | CNNs | Causality | Reasoning | LSTMs | Transformers | Multi-Head Self Attention | Published in IEEE Winter Conference on Applications of Computer Vision (WACV) 2021
Stars: ✭ 52 (-31.58%)
Mutual labels:  attention, self-attention
eeg-rsenet
Motor Imagery EEG Signal Classification Using Random Subspace Ensemble Network
Stars: ✭ 24 (-68.42%)
Mutual labels:  eeg, eeg-classification
seq2seq-pytorch
Sequence to Sequence Models in PyTorch
Stars: ✭ 41 (-46.05%)
Mutual labels:  attention, self-attention
brain-powered
With the Brain Powered honourscourse at the UvA we aimed to control a drone using brain signals, measured by means of EEG, only.
Stars: ✭ 13 (-82.89%)
Mutual labels:  eeg, eeg-classification
bert attn viz
Visualize BERT's self-attention layers on text classification tasks
Stars: ✭ 41 (-46.05%)
Mutual labels:  attention
flow1d
[ICCV 2021 Oral] High-Resolution Optical Flow from 1D Attention and Correlation
Stars: ✭ 91 (+19.74%)
Mutual labels:  attention
ewtpy
Empirical wavelet transform (EWT) in Python
Stars: ✭ 52 (-31.58%)
Mutual labels:  eeg-classification
eeguana
A package for manipulating EEG data in R.
Stars: ✭ 16 (-78.95%)
Mutual labels:  eeg
connectomemapper3
Connectome Mapper 3 is a BIDS App that implements full anatomical, diffusion, resting/state functional MRI, and recently EEG processing pipelines, from raw T1 / DWI / BOLD , and preprocessed EEG data to multi-resolution brain parcellation with corresponding connection matrices.
Stars: ✭ 45 (-40.79%)
Mutual labels:  eeg
openmeeg
A C++ package for low-frequency bio-electromagnetism solving forward problems in the field of EEG and MEG.
Stars: ✭ 62 (-18.42%)
Mutual labels:  eeg
AiR
Official Repository for ECCV 2020 paper "AiR: Attention with Reasoning Capability"
Stars: ✭ 41 (-46.05%)
Mutual labels:  attention
thesis
MSc thesis on: Classifying brain activity using EEG and automated time tracking of computer use (using ActivityWatch)
Stars: ✭ 44 (-42.11%)
Mutual labels:  eeg
EEG convolutional neural net
A convolutional neural network developed in python using the Keras machine learning framework used to categorize brain signal based on what a user was looking at when the EEG data was collected.
Stars: ✭ 20 (-73.68%)
Mutual labels:  eeg
Recurrent-Independent-Mechanisms
Implementation of the paper Recurrent Independent Mechanisms (https://arxiv.org/pdf/1909.10893.pdf)
Stars: ✭ 90 (+18.42%)
Mutual labels:  attention
ScouseTom
Open Source EIT system using Keithley 6221 current source and EEG systems
Stars: ✭ 17 (-77.63%)
Mutual labels:  eeg
Generative MLZSL
[TPAMI Under Submission] Generative Multi-Label Zero-Shot Learning
Stars: ✭ 37 (-51.32%)
Mutual labels:  self-attention
Transformer-in-PyTorch
Transformer/Transformer-XL/R-Transformer examples and explanations
Stars: ✭ 21 (-72.37%)
Mutual labels:  self-attention

AttnSleep

AttnSleep: An Attention-based Deep Learning Approach for Sleep Stage Classification with Single-Channel EEG

by: Emadeldeen Eldele, Zhenghua Chen, Chengyu Liu, Min Wu, Chee-Keong Kwoh, Xiaoli Li, and Cuntai Guan

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

Abstract

AttnSleep Architecture Automatic sleep stage classification is of great importance to measure sleep quality. In this paper, we propose a novel attention-based deep learning architecture called AttnSleep to classify sleep stages using single channel EEG signals. This architecture starts with the feature extraction module based on multi-resolution convolutional neural network (MRCNN) and adaptive feature recalibration (AFR). The MRCNN can extract low and high frequency features and the AFR is able to improve the quality of the extracted features by modeling the inter-dependencies between the features. The second module is the temporal context encoder (TCE) that leverages a multi-head attention mechanism to capture the temporal dependencies among the extracted features. Particularly, the multi-head attention deploys causal convolutions to model the temporal relations in the input features. We evaluate the performance of our proposed AttnSleep model using three public datasets. The results show that our AttnSleep outperforms state-of-the-art techniques in terms of different evaluation metrics.

Requirmenets:

  • Intall jq package (for linux)
  • Python3.7
  • Pytorch=='1.4'
  • Numpy
  • Sklearn
  • Pandas
  • openpyxl
  • mne=='0.20.7'

Prepare datasets

Update: The preprocessed datasets are now available on this Dataverse

We used three public datasets in this study:

After downloading the datasets, you can prepare them as follows:

cd prepare_datasets
python prepare_physionet.py --data_dir /path/to/PSG/files --output_dir edf_20_npz --select_ch "EEG Fpz-Cz"
python prepare_shhs.py --data_dir /path/to/EDF/files --ann_dir /path/to/Annotation/files --output_dir shhs_npz --select_ch "EEG C4-A1"

Training AttnSleep

For updating the training parameters, you have to update the config.json file. In this file, you can update:

  • The experiment name (Recommended to update this for different experiments)
  • The number of GPUs.
  • Batch size.
  • Number of folds (as we use K-fold cross validation).
  • Optimizer type along with its parameters.
  • the loss function. (to update this you have to include the new loss function in the loss.py file).
  • the evaluation metrics (also to add more metrics, update the metrics.py file).
  • The number of training epochs.
  • The save directory (location of saving the results of experiment)
  • The save_period (the interval of saving the checkpoints and best model).
  • verbosity of log (0 for less logs, 2 for all logs, 1 in between)

To perform the standard K-fold cross validation, specify the number of folds in config.json and run the following:

chmod +x batch_train.sh
./batch_train.sh 0 /path/to/npz/files

where the first argument represents the GPU id (If you want to use CPU, set the number of gpus to 0 in the config file)

If you want to train only one specific fold (e.g. fold 10), use this command:

python train_Kfold_CV.py --device 0 --fold_id 10 --np_data_dir /path/to/npz/files

Results

The log file of each fold is found in the fold directory inside the save_dir.
The final classification report is found the experiment directory and note that it sums up all the folds results to calculate the metrics.

Citation

@article{emadeldeen_attnSleep,
  author={Eldele, Emadeldeen and Chen, Zhenghua and Liu, Chengyu and Wu, Min and Kwoh, Chee-Keong and Li, Xiaoli and Guan, Cuntai},
  journal={IEEE Transactions on Neural Systems and Rehabilitation Engineering}, 
  title={An Attention-based Deep Learning Approach for Sleep Stage Classification with Single-Channel EEG}, 
  year={2021},
  volume={29},
  pages={809-818},
  doi={10.1109/TNSRE.2021.3076234}
}

Contact

Emadeldeen Eldele
School of Computer Science and Engineering (SCSE)
Nanyang Technological University, Singapore
Email: emad0002{at}e.ntu.edu.sg

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].