Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code for BHI 2023 Paper on EEG Seizure Detection

NotificationsYou must be signed in to change notification settings

UnitedHolmes/seizure_detection_EEGs_transformer_BHI_2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository provides code for the EEGNet + Transformer model for EEG seizure detection proposed in the paper: Automated Seizure Detection using Transformer Models on Multi-Channel EEGs

Authors: Yuanda Zhu, Prof. May D. Wang

Affiliation: Georgia Institute of Technology, Atlanta, GA, USA

🔗Connect with Yuanda on LinkedIn

🔗Check Yuanda's Google Scholar

🔗Check Professor Wang's Google Scholar

Feel free to know more about us and our lab:

Lab Information

Contents of This Repo

  1. Development Environment
  2. Dataset Description
  3. Preprocessing Steps
  4. Our Proposed Approach
  5. Implementation of Models from Literature
  6. References

Development Environment

  • Navigate to this folder, create the conda environment for EEG seizure detection using the environment.yml file. Make sure GPU is available and CUDA is installed.
conda env create -f environment.yml
  • Activate the environment
conda activate myEEGs

Dataset Description

Temple University Hospital (TUH) EEG Corpus includes a large number of EEGs data. Detailed information and instructions are summarized in this page:https://isip.piconepress.com/projects/tuh_eeg/html/downloads.shtml

Request access to TUH EEG Corpus.

According to TUH EEG website,

"To request access to the TUH EEG Corpus, please fill outthis form and email a signed copy tohelp@nedcdata.org. Please include "Download The TUH EEG Corpus" in the subject line."

Access the The TUH EEG Seizure Corpus (TUSZ) dataset

Once you receive the username and password from the dataset owner, please find the TUSZ dataset here:https://isip.piconepress.com/projects/tuh_eeg/downloads/tuh_eeg_seizure/

If you want to download the latest version of the dataset, you can use "Rsync" command. The latest version is v2.0.0 as of 08/16/2023.

rsync -auxvL --delete nedc-eeg@www.isip.piconepress.com:data/eeg/tuh_eeg_seizure/v2.0.0/ .

Notes from the webpage:

  1. "Note that the "." at the end of this command is very important since it denotes the destination directory. Without a destination directory specification, the command will not transfer any data."

  2. "The username and password are the same as what you use to access the web-based version of these resources."

  3. "Note that the "-L" option in rsync instructs it to follow links. All of our corpora are linked back to TUEG. It is best to always use the "-L" option."

Dataset used in this project is v1.5.2

The TUSZ dataset used in this project is an older version (v1.5.2). It has a hierarchical structure as shown in the figure below.

TUSZ v1.5.2 data structure

Please note that the latest version has a slightly different hierarchical structure than the old one. Please refer to

Preprocessing Steps

Please use these two Juypter Notebooks to preprocess the TUSZ data (v1.5.2):

  • new_preprocess_TUSZ_data_preparation.ipynb This file fulfills all steps described in the data preprocessing steps. This file is only valid for v1.5.2.
    • Please note that this filenew_preprocess_TUSZ_data_preparation.ipynb utilizes functions implemented indata_reader_new.py. It is only applicable to v1.5.2.
    • If you wish to try our code with the latest version (v2.0.0), please use this jupyter notebooknew_preprocess_TUSZ_2023_data_preparation.ipynb, which imports functions from filedata_reader_2023.py. Please carefully debug if there is any error. In v2.0.0, channel-level annotations are available.
  • copy_balanced_samples.ipynb This file is only to undersample the major class samples so that we will have the equal number of samples across different classes.

Our Proposed Approach

Our proposed approach is implemented in file:my_own_train_with_EEGNet_Transformer_ver2_hyperparameter_tuning.py

Overall diagram

Here is an overall diagram of our proposed approach.

Overall Diagram

Model architecture and output shape

Model architecture and data/ output shape is shown here:

ModuleLayer# FiltersKernel SizeOutput Shape
Input EEG(batch size, 22, 1000)
CNNTemporal Conv2D64(1, K_C1)(batch size, 64, 22, 1000)
Batch Norm
DepthWise Conv2D256(C, 1)(batch size, 256, 1, 1000)
Batch Norm
ELU
Average Pooling(1, 5)(batch size, 256, 1, 200)
Separable Conv2D(1, 16)
Batch Norm
ELU
Average Pooling(1, 5)(batch size, 256, 1, 40)
TransformerInsert a Learnable Vector(257, batch size, 40)
Positional Encoding
Transformer Encoder Layers
ClassificationLinear Layer(batch size, 2)

Binary seizure detection results

PrecisionRecallF1-ScoreSupport
No Seizure0.8640.8050.833101,368
Seizure0.5840.6830.63040,650
Macro Avg0.7240.7440.731142,018
Weighted Avg0.7830.7700.775142,018

Implementation of Models from Literature

Additionally, we implemented/ replicated codes from literature and follow the same training/ testing pipeline on our processed dataset.

These papers include:

  • EEGNet,paper
    • Implemented in filesomeone_else_train_with_EEGNet_only.py
  • EEG-TCNet,paper,original code
    • Implemented in filesomeone_else_train_with_TCNet.py
  • EEG-ACTNet,paper,original code
    • Implemented in filesomeone_else_train_with_ACTNet.py
  • Sun et al. 2022 JBHI,paper
    • Implemented in filesomeone_else_train_with_CNN_and_Transformers.py

Results comparison

Approach/ PaperKey Model ComponentsMacro F1Macro PrecisionMacro Recall
EEGNet, 2018EEGNet0.7000.7060.696
EEG-TCNet, 2020EEGNet + TCN0.6890.6950.738
ATCNet, 2022EEGNet + MSA + TCN0.7070.7060.707
Sun et al., 2022Shallow CNN + Transformer Encoder0.7100.7020.732
OursEEGNet + Transformer Encoder0.7310.7240.744

References

If you find this work useful in your research, please use the following BibTeX entry for citation:

@inproceedings{Zhu23Automated, AUTHOR = {Yuanda Zhu and May Dongmei Wang}, TITLE = {Automated Seizure Detection using Transformer Models on {Multi-Channel}{EEGs}}, BOOKTITLE = {2023 IEEE EMBS International Conference on Biomedical and Health Informatics (BHI) (IEEE BHI 2023)}, ADDRESS = {Pittsburgh, USA}, PAGES = {21}, DAYS = {15}, MONTH = {October}, YEAR = {2023},}

About

Code for BHI 2023 Paper on EEG Seizure Detection

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp