ECG Heartbeat Classification Based on an Improved ResNet-18 Model

Haiyang Zhang, Enbiao Jing, Haiyang Zhang 0004, Zhigang Li, Yazhi Liu, Zhanlin Ji, Ivan GanchevComput. Math. Methods Medicine 2021 · DOI

TL;DR

This paper introduces an improved ResNet-18 model for classifying electrocardiogram (ECG) heartbeats, achieving a high accuracy of 96.50% on the MIT-BIH arrhythmia database. By incorporating wavelet denoising and a modified ResNet architecture, the model effectively extracts deep features from ECG signals, outperforming existing state-of-the-art methods.

What Problem Does This Paper Address?

Cardiovascular diseases (CVDs) are a leading cause of death worldwide, and timely detection of arrhythmias through ECG analysis is crucial for patient outcomes. However, ECG signals are inherently noisy and complex, making manual interpretation time-consuming and prone to error. While automated methods exist, accurately classifying the diverse types of heartbeats, especially rare ones, remains a challenge. This paper aims to improve the accuracy and efficiency of ECG heartbeat classification by developing a robust deep learning model.

Methods

The authors propose an improved ResNet-18 model for ECG heartbeat classification. The methodology involves several key steps:

  • ECG Signal Denoising: Wavelet transform, specifically using the Daubechies (db8) wavelet base with 9 decomposition levels and soft thresholding, is employed to remove various noises (e.g., baseline drift, muscle artifacts, powerline interference) from the ECG signals. This step is crucial for enhancing the quality of the input data.
  • Data Slicing and Labeling: ECG signals are segmented into 3-second slices. A novel labeling strategy is introduced: a slice is labeled "normal" only if all heartbeats within it are normal; otherwise, it's labeled "abnormal." In cases of multiple abnormal types, the most represented type or the first occurring anomaly defines the slice type. Slice overlapping is also used to increase the dataset size.
  • Improved ResNet-18 Architecture: The core of the proposed method is an enhanced ResNet-18 architecture. This includes:
  • Initial Convolutional Layer: A 1D convolution kernel of size 32 is used to extract initial features, which is larger than typical kernels used for 2D image classification, to better handle the characteristics of ECG signals.
  • Classic ResNet-18 Layers: Standard ResNet-18 blocks are utilized for feature extraction.
  • Improved ResNet-18 Layer: A batch normalization layer is added before the classical ResNet-18 structure to accelerate training and improve stability.
  • Fully Connected Layer and Softmax: The extracted features are mapped to a one-dimensional vector, which is then processed by a softmax function for multiclassification, outputting probabilities for each heartbeat class.
  • L2 Regularization: Applied to convolutional and fully connected layers to prevent overfitting and speed up convergence.
  • Training Strategy: The model is trained using the stochastic gradient descent (SGD) optimizer with a cross-entropy loss function. An initial learning rate of 0.1 is used, with a step change adopted later. The experiments utilize an interpatient classification method, where data from different patients are used for training and testing, making the evaluation more realistic.

Datasets

The primary dataset used in this study is the MIT-BIH Arrhythmia Database. This database consists of 48 half-hour, two-channel ambulatory ECG recordings from 47 subjects. The paper specifies that 44 records were used for experiments, with 22 designated for testing and the remaining split into training and validation sets. The dataset contains 15 types of heartbeats mapped to 5 AAMI heartbeat classes. No new benchmark datasets were introduced.

Key Insights and Ideas

  • Wavelet Denoising is Critical: The paper highlights that effective denoising of ECG signals using wavelet transform is a prerequisite for accurate classification, as noise can significantly distort features.
  • Interpatient Classification is More Realistic: The authors emphasize the importance of using an interpatient classification approach for evaluating models, as it better reflects real-world scenarios where a model must generalize to unseen patients, unlike intrapatient methods that can lead to inflated performance metrics.
  • Larger 1D Kernels for ECG: The choice of a larger 1D convolution kernel (32) for ECG signals, compared to typical 3x3 kernels for 2D images, is a key insight. This is justified by the unique characteristics of ECG data, which is more susceptible to noise and requires broader feature extraction.
  • ResNet's Suitability for Deep Feature Extraction: The paper reinforces the effectiveness of ResNet architectures for deep feature learning in complex time-series data like ECGs, enabling the model to capture subtle patterns indicative of arrhythmias.
  • Class Imbalance is a Major Hurdle: The authors acknowledge that the significant imbalance in the number of heartbeats across different classes (e.g., very few 'F' and 'Q' beats) negatively impacts the sensitivity for these classes.

Key Results

  • Overall Accuracy: The proposed improved ResNet-18 model achieved an overall classification accuracy of 96.50% on the MIT-BIH arrhythmia database.
  • Performance Comparison: This accuracy is superior to other state-of-the-art models compared in the study, including End-to-end DNN [15] (94.70%), 1D-CNN [10] (95.13%), and BbNNs [18] (94.49%).
  • Specific Class Performance: For the ventricular ectopic heartbeat class (V), the model achieved a sensitivity of 93.83% and a precision of 97.44%.
  • Training Efficiency: The improved ResNet-18 model converges faster than deeper ResNet variants (like ResNet-34) and reduces both model training and testing time for complex ECG images.
  • Sensitivity for Rare Classes: While overall accuracy is high, sensitivity for less frequent classes like 'S' (76.45%) and 'F' (63.56%) is lower, attributed to class imbalance.

Limitations and Future Work

  • Class Imbalance: The most significant limitation identified is the imbalance in the number of heartbeats across different classes in the MIT-BIH dataset. This leads to lower sensitivity for rare arrhythmia types.
  • Future Work Suggestions: To address class imbalance, the authors suggest:
  • Modifying the loss function to give more weight to minority classes.
  • Applying data augmentation techniques (e.g., cutting and splicing ECG data) to increase the representation of underrepresented classes.
  • Introducing specific features for small categories to improve their identification.
  • Further research into the clinical application prospects of the model.

Summary updated

BibTeX
@article{zhang2021ecg,
  author = {Haiyang Zhang and Enbiao Jing and Haiyang Zhang and Zhigang Li and Yazhi Liu and Zhanlin Ji and Ivan Ganchev},
  title = {{ECG Heartbeat Classification Based on an Improved ResNet-18 Model}},
  journal = {Comput. Math. Methods Medicine},
  year = {2021},
  doi = {10.1155/2021/6649970},
}
Figure