Skip to content

gilad-altshuler/ECG-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

ECG classification

Depository for deep learning course project

ECG gif R

About

Electrocardiogram (ECG) can be reliably used as a measure to monitor the functionality of the cardiovascular system. In this project, we analyze the method based on deep convolutional neural networks for the classification of heartbeats which is able to accurately classify five different arrhythmias in accordance with the AAMI EC57 standard and a method for transferring the knowledge acquired on this task to the myocardial infarction (MI) classification task.

This project goals are 3:

  • Design simple yet accurate model to the prediction task.
  • Try to transfer the learnt model for Arrhythmia task for MI task.
  • Comprehend the CNN layers and their meanings.

Datasets

Content:

Arrhythmia Dataset

  • Number of Samples: 109444
  • train / test: 80% / 20%
  • Number of Categories: 5
  • Sampling Frequency: 125Hz
  • Data Source: Physionet's MIT-BIH Arrhythmia Dataset
  • Classes: ['N': 0, 'S': 1, 'V': 2, 'F': 3, 'Q': 4]
  • Classes proportion: [0.83, 0.03, 0.07, 0.01, 0.07]
  • Dataset link : https://www.kaggle.com/shayanfazeli/heartbeat

MI (myocardial infarction) Dataset

  • Number of Samples: 14550
  • train / test: 80% / 20%
  • Number of Categories: 2
  • Sampling Frequency: 125Hz
  • Data Source: PTB Diagnostic ECG Database
  • Classes: ['normal': 0, 'abnormal': 1]
  • Classes proportion: [0.28, 0.72]
  • Dataset link : https://www.kaggle.com/shayanfazeli/heartbeat

Preprocessing:

image

  • Sampled ECG heartbeat preproccessed by this scheme:

    • Splitting the continuous ECG signal to 10s windows and select a 10s window from an ECG signal.
    • Normalizing the amplitude values to the range of between zero and one.
    • Finding the set of all local maximums based on zero crossings of the first derivative.
    • Finding the set of ECG R-peak candidates by applying a threshold of 0:9 on the normalized value of the local maximums.
    • Finding the median of R-R time intervals as the nominal heartbeat period of that window (T).
    • For each R-peak, selecting a signal part with the length equal to 1.2T.
    • Padding each selected part with zeros to make its length equal to a predefined fixed length.
  • After preprocessing

image

  • 5 example from dataset, and their labels

examples

Proposed CNN model

we wanted the model to be simple, yet accurate, and genaralizable enough to be able to transfer between the 2 datasets. We chose the CNN model:

image

with 4 convolution layers and 4 fully connected layers.

Results

  • Training the model on datasets:

image image

comparing results:

image

  • Transferring the Arrhythmia task model to MI task, with each number of trained layers:

image image

  • input through layers example:

image

Run

All the codelines needed can be found in ECG_classification.ipynb. To be able to run the dataset one need to:

(1) Download manually the datasets from https://www.kaggle.com/shayanfazeli/heartbeat.

(2) Uploading to your drive to the directory /content/drive/MyDrive/Deep_Learning/datasets (default in code)

(3) One can choose other directory in drive, but change the link in the code.*

*the last directory must be called "datasets"

This will allow the rest of code to use the heartbeats datasets.

Files in The Repository

File name Purpsoe
README.md readme
ECG_classification.ipynb code section for the model and trials
submissions directory for project submitted files

Acknowledgement

  • ECG Heartbeat Classification: A Deep Transferable Representation, Kachuee et Al. 2018
  • “Improved Neural Network Arrhythmia Classification Through Integrated Data Augmentation” - Garrett I. Cayce et Al, 2022.
  • “Architecture Enhancement of Convolutional Neural Networks for Arrhythmia Classification” - Hae Jin Kim et Al, 2022.
  • “Electrocardiogram heartbeat classification based on a deep convolutional neural network and focal loss” - Taissir FekihRomdhane et Al, 2020.
  • https://github.com/sajiddeboss/ECG-HeartBeat-Classification
  • https://www.kaggle.com/datasets/shayanfazeli/heartbeat

About

depository for deep learning course assignments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors