ECG is a biosignal that provides insight on heart's electrical activity and it's rythm. Detecting Arrythmia from ECG signals require medical expertise which is not accessible to all. A machine learning model paired with a ECG Holter can help address this issue.
This project utilizes MIT-BIH dataset to train different machine learning models (LR, SVM and CNN) and find the optimum model for arrythmia detection. Based on the R-peak of ECG signal, the models classify the ECG signals into seven categories:
- Normal
- Arrhythmias
- Left Bundle Branch Block
- Right Bundle Branch Block
- Premature Ventricular Contraction
- Ventricular Escape Rhythm
- Paced Rhythm
- Atrial Premature Contraction
The MIT-BIH Arrhythmia Dataset was the first set of standard test material that was generally available to evaluate arrhythmia detection. ECG signals were described by a text header file (.hea), a binary file (.dat) and a binary annotation file (.atr). The source of the ECGs included in the MIT-BIH Arrhythmia Database is a set of over 4000 long-term Holter recordings. In most records, the upper signal is a modified limb lead II (MLII), obtained by placing the electrodes on the chest.
Data ExtractionR-Peak DetectionECG Signal SegmentationResampleStandardizeTrain Model (LR, SVM, 1D-CNN)Test Model (Precision, Recall, Accuracy, Loss, Confusion Matrix)Web Deployment
Paced | APC | VEB | LBB | Normal | RBB | PVC | Total | |
---|---|---|---|---|---|---|---|---|
Training data | 16200 | 16200 | 16200 | 16200 | 16200 | 16200 | 16200 | 113400 |
Validation data | 1800 | 1800 | 1800 | 1800 | 1800 | 1800 | 1800 | 12600 |
Correct Prediction | 16194 | 16170 | 16200 | 16189 | 16140 | 16191 | 16165 | 113249 |
Sensitivity | 99.9% | 99.8% | 100% | 99.9% | 99.6% | 99.9% | 99.7% | 99.8% |
The training performance gradually improved after each iteration and remained stable. After 25 iterations or epochs, an averaged accuracy of 99.8% was achieved in the validation set for the arrhythmia classification. The loss also reduced after each iterations and an average loss of 0.5% was achieved.
- DSP (bioSPPy)
- sklearn
- Matplotlib
- Pandas
- Numpy
- wfdb
- Keras/ tensorflow