Heart-Arrhythmia-Classification
Instructions to run
- Note down the location of the ".edf" file and enter it into the EDF_PATH variable
- Run the predict.py file to get the output
Dataset
The original datasets used are the MIT-BIH Arrhythmia Dataset and that are preprocessed based on the methodology described in the paper below in order to end up with samples of a single heartbeat each and normalized amplitudes.
Kachuee, M., Fazeli, S., & Sarrafzadeh, M. (2018). ECG Heartbeat Classification: A Deep Transferable Representation. 2018 IEEE International Conference on Healthcare Informatics (ICHI). https://doi.org/10.1109/ichi.2018.00092 (https://arxiv.org/pdf/1805.00794.pdf)
The process followed is:
- 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 zerocrossings 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.
MIT-BIH Arrhythmia dataset :
- Number of Categories: 5
- Number of Samples: 109446
- Sampling Frequency: 125Hz
- Data Source: Physionet’s MIT-BIH Arrhythmia Dataset
- Classes: [’N’: 0, ‘S’: 1, ‘V’: 2, ‘F’: 3, ‘Q’: 4]
Class distribution in the dataset
- Before Resampling
- After Resampling
Model
Results
- Accuracy: 73%
Figure 2: Accuracy and Loss Plot
Figure 4: Classification Report