GithubHelp home page GithubHelp logo

iobt-vistec / eegwavenet Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 6.0 659 KB

source codes for EEGWaveNet: Multi-Scale CNN-Based Spatiotemporal Feature Extraction for EEG Seizure Detection (IEEE Transactions on Industrial Informatics)

Python 100.00%
pytorch deep-learning cnn eeg-classification seizure eeg ai healthcare convolutional-neural-networks machine-learning

eegwavenet's Introduction

EEGWaveNet: Multi-Scale CNN-Based Spatiotemporal Feature Extraction for EEG Seizure Detection

DOI

Abstract

The detection of seizures in epileptic patients via Electroencephalography (EEG) is an essential key to medical treatment. With the advances in deep learning, many approaches are proposed to tackle this problem. However, concerns such as performance, speed, and subject-independency should still be considered. Thus, we propose EEGWaveNet, a novel end-to-end multi-scale convolutional neural network designed to address epileptic seizure detection. Our network utilizes trainable depth-wise convolutions as discriminative spectral filters to gather multi-scale spectral information from each EEG channel. Then, the spatial-temporal features are extracted from each scale for further classification. To demonstrate the effectiveness of EEGWaveNet, we evaluate the model in two datasets: CHB-MIT and TUSZ. From the results, EEGWaveNet outperforms other baseline methods in performance for both subject-dependent and independent approaches, while having time complexity comparable to the compact EEGNet-8,2. Moreover, we transfer the model trained from the subject-independent approach and fine-tune it with a one-hour recording, achieving an F1-score (Binary) improvement of about 15% in average compared to without fine-tuning. This study indicates the possibility of further developing this model and the fine-tuning methodology toward healthcare 5.0, where the AI aid clinicians in a manner of man-machine collaboration.

alt text

Figure: Overall visualization of EEGWaveNet architecture (a) Multi-scale convolution module, (b) Spatial-temporal feature extraction module, and (c) Classifier module consists of fully connected layers and activation for two-class classification.

Installation

If git is avaliable, installation can be done via

git clone https://github.com/IoBT-VISTEC/EEGWaveNet

Example of our code's usage

import torch
import numpy as np
import architecture
import trainer

#model
Model = architecture.Net(21,2).float()

#dummy data #shape as follow
X_train = torch.tensor(np.random.rand(800,21,1024)).float()
X_val = torch.tensor(np.random.rand(200,21,1024)).float()
#label
y_train = torch.tensor(np.array([np.random.choice([0,1]) for i in range(800)])).long()
y_val = torch.tensor(np.array([np.random.choice([0,1]) for i in range(200)])).long()

Train_set = (X_train,y_train)
Val_set = (X_val,y_val)

Trainer = trainer.trainer(Model, Train_set, Val_set, 2)

Trainer.compile(learning_rate=0.001)
Tracker = Trainer.train(epochs=50, batch_size=32, patience=10, directory='model.pt')

print(Tracker)

Versions used in our code testing

Note that different versions won't likely cause dependencies issues. Using TensorFlow instead of PyTorch may require kernel initializer settings to be changed, as using TensorFlow's initializers cause a drop in performance.

pytorch = 1.9.0
numpy = 1.19.2
sklearn = 0.24.1

For any inconvernienes and bug reports, contact [email protected]

Citation

Thuwajit, Punnawish, et al. "EEGWaveNet: Multi-Scale CNN-Based Spatiotemporal Feature Extraction for EEG Seizure Detection." IEEE Transactions on Industrial Informatics (2021).

@article{thuwajit2021eegwavenet,
  title={EEGWaveNet: Multi-Scale CNN-Based Spatiotemporal Feature Extraction for EEG Seizure Detection},
  author={Thuwajit, Punnawish and Rangpong, Phurin and Sawangjai, Phattarapong and Autthasan, Phairot and Chaisaen, Rattanaphon and Banluesombatkul, Nannapas and Boonchit, Puttaranun and Tatsaringkansakul, Nattasate and Sudhawiyangkul, Thapanun and Wilaiprasitporn, Theerawit},
  journal={IEEE Transactions on Industrial Informatics},
  year={2021},
  publisher={IEEE}
}

eegwavenet's People

Contributors

iobt-vistec avatar kkuroma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.