According to the World Health Organization (WHO), cardiovascular diseases (CVDs) are the number one cause of death today. Over 17.7 million people died from CVDs in the year 2017 all over the world which is about 31% of all deaths, and over 75% of these deaths occur in low and middle income countries. Arrhythmia is a representative type of CVD that refers to any irregular change from the normal heart rhythms. There are several types of arrhythmia including atrial fibrillation, premature contraction, ventricular fibrillation, and tachycardia. Although single arrhythmia heartbeat may not have a serious impact on life, continuous arrhythmia beats can result in fatal circumstances. For example, prolonged premature ventricular contraction (PVCs) beats occasionally turn into a ventricular tachycardia (VT) or ventricular fibrillation (VF) beats which can immediately lead to heart failure. Thus, it is important to periodically monitor the heart rhythms to manage and prevent the CVDs. Electrocardiogram (ECG) is a non-invasive medical tool that displays the rhythm and status of the heart. Therefore, automatic detection of irregular heart rhythms from ECG signals is a significant task in the field of cardiology.
- Identification of arrhythmia condition from ECG signal takes a lot of experience even for experienced cardiologists.
- Harmful arrhythmia conditions occur rarely so less data for analysis and prediction
- Neural networks are good at signal classification.
- lot of wearable devices available to monitor ECG of the user
This project is intended to identify and classify various heart conditions using a 2-D convolutional neural network in which we classify ECG into five categories, one being normal and the other four being different types of arrhythmia beats.The user will have a website to upload the raw ecg signal and the website will diplay the result of classification
- Wavelet transform/Fourier transform
- Conv1D neural network
- Window based approach
- Conv2D network was used for classification and cnn is trained using grayscale images of ECG signals
- r-r interval is used instead of window based apporach
- The system is able to take ECG signal at various sampling frequency
- The system has a display and store unit which can be used by physicians for further reference
- Peak detection.
- Dividing the signal into multiple sub parts using peaks obtained from peak detection.
- Converting the segmented signal into image.
- Training of the CNN neural network using images of signals
- Classification of ECG signal whether it is normal or harmful
- Website to load and visualize the classification results
- Pantombkins algorithm(my choice)
- Wavelet transformation
- Two moving averages
- Hamilton algorithm
I tested neurokit2 python package for detection of r peaks.checked the annotation provided with original annotation.neurokit2 was able to predict annotation with 99.8% accuracy.also documentation of neurokit2 has functions to take ecg signal of various sampling ffrequency.I am currently developing pantombkins algorithm using python
[dataset](https://physionet.org/content/mitdb/1.0.0/)360HZ
48 Samples of 30 minutes, 2 leads 47 Patients:
- 100 series: 23 samples
- 200 series: 25 samples. Contains uncommon but clinically important arrhythmias
Symbol | Meaning |
---|---|
· or N | Normal beat |
L | Left bundle branch block beat |
R | Right bundle branch block beat |
A | Atrial premature beat |
a | Aberrated atrial premature beat |
J | Nodal (junctional) premature beat |
S | Supraventricular premature beat |
V | Premature ventricular contraction |
F | Fusion of ventricular and normal beat |
[ | Start of ventricular flutter/fibrillation |
! | Ventricular flutter wave |
] | End of ventricular flutter/fibrillation |
e | Atrial escape beat |
j | Nodal (junctional) escape beat |
E | Ventricular escape beat |
/ | Paced beat |
f | Fusion of paced and normal beat |
x | Non-conducted P-wave (blocked APB) |
Q | Unclassifiable beat |
There are 15 recommended classes for arrhythmia that are classified into 5 superclasses:
SuperClass | ||||||
---|---|---|---|---|---|---|
N (Normal) | N | L | R | |||
SVEB (Supraventricular ectopic beat) | A | a | J | S | e | j |
VEB (Ventricular ectopic beat) | V | E | ||||
F (Fusion beat) | F | |||||
Q (Unknown beat) | P | / | f | u |
- 2d cnn model that is able to classify ecg signals
- website that can take the ecg signal as input and output the classification result
- python
- tensorflow
- html
- css
- numpy
- tensorflow
- pandas
- wfdb
- neurokit2
- week1,2:litreature review
- week3:training of a 1d cnn model using kaggle dataset and demonstration
- week4:converting the raw signal and annotation into csv and txt file
- week5:learn html,css,javascrpt
- week6:website development,stanford idea implementation(fitbit)
- week6:converting the ecg signal into grayscale images,dividing of images into 5 super classes for training purposes
- week7,week8,week 9:training of the neural network and optimization of neural network
- week 10,week 11:implementation of pan tompkins algorithm to detect r peaks,testing of neurokit2 library
- week 12:setting up a jupyter notebook for mid evaluation
- training the neural network with V1 lead
- fine tuning the neural network
- setting up the GUI using Tkinter for demonstration
- initially the signal and annotations were converted into csv file for easy formatting.
- then the signal is segmented into segments.each segment represent R-R intervalof a signal
- then segments are grouped into 5 categories namely normal,fusion,sveb,veb and unknown beats 
- the data samples used for training are [101,106, 108, 109, 112, 114, 115, 116, 118, 119, 122, 124, 201, 203, 205, 207, 208, 209, 215, 220, 223, 230]
- the data samples used for testing are [100, 103, 105, 111, 113, 117, 121, 123, 200, 202, 210, 212, 213, 214, 219, 221, 222, 228, 231, 232, 233, 234]
- hold out validation is used so that to identify how the neural network performs well for new dataset and restricted computation power
jupyter notebook used for segmenting and grouping of ecg signal is
[annotator](https://github.com/juzailml98/ecg-identifier/blob/master/annotator.ipynb)- the dataset used for training of neural network has the following distribution 
- the model trained was able to classify the signal into 5 categories
- the model was trained for 10 epoch and obtained accuracy of 94.9,recall of 92.1 and precision of 93.4
- intended to downsample the number of normal samples
for better identifying the abnormal beats classification is done on 4 classes they are sveb,veb,usion ,normal two state architecture is to be used
the original mit-bih dataset consists of
- normal beats:83000
- sveb beats:3013
- veb beats:6335
- fusion beats:801
- other beats:2309
the dataset is very unbalanced due to high availability of normal beats and low availability of other classes
normal beats are divided into 45035 and 38032 as training set and testing set
the training set normal beats are downsampled to 10000 from 45000
the ecg-classifer website is built using css,javascript and html.the website takes the raw ecg signal or csv converted ecg signal as input.the file uploaded will be sent to backend where the classification happens.the backend is being built using flask.
