Optical Electrocardiogram Based Heart Disease Prediction Using Hybrid Deep Learning
Optical Electrocardiogram Based Heart Disease Prediction Using Hybrid Deep Learning
*Correspondence:
[email protected] Abstract
1
Department of Computer The diagnosis and categorization of cardiac disease using the low-cost tool electro-
Science & Engineering, cardiogram (ECG) becomes an intriguing study topic when contemplating intelligent
Koneru Lakshmaiah Education healthcare applications. An ECG-based cardiac disease prediction system must be
Foundation, Vijayawada, AP, India
automated, accurate, and lightweight. The deep learning methods recently achieved
automation and accuracy across multiple domains. However, applying deep learning
for automatic ECG-based heart disease classification is a challenging research problem.
Because using solely deep learning approaches failed to detect all of the important
beats from the input ECG signal, a hybrid strategy is necessary to improve detection
efficiency. The main objective of the proposed model is to enhance the ECG-based
heart disease classification efficiency using a hybrid feature engineering approach.
The proposed model consists of pre-processing, hybrid feature engineering, and clas-
sification. Pre-processing an ECG aims to eliminate powerline and baseline interfer-
ence without disrupting the heartbeat. To efficiently classify data, we design a hybrid
approach using a conventional ECG beats extraction algorithm and Convolutional Neu-
ral Network (CNN)-based features. For heart disease prediction, the hybrid feature vec-
tor is fed successively into the deep learning classifier Long Term Short Memory (LSTM).
The results of the simulations show that the proposed model reduces both the num-
ber of diagnostic errors and the amount of time spent on each one when compared
to the existing methods.
Keywords: Convolutional neural network, Electrocardiogram, Heart disease detection,
Classification, Smart healthcare
Introduction
Identifying heart diseases from an electrocardiogram (ECG) increasingly necessitates the
use of computer-aided diagnosis (CAD) software. Numerous established methods for
the immediate detection of cardiac abnormalities have been offered [1]. ECG signals are
analyzed by auto-correlation work, frequency area features, time–frequency study, and
wavelet transformation to spot these abnormalities. Separating abnormal ECG signals
and meritoriously organizing them is still in progress [2–4], notwithstanding successful
patient classification. As an ECG signal may comprise a wide variety of heartbeats or
waves, feature extraction from the data is essential. After the ECG signal has been pro-
cessed, it comprises several different waves that, taken together, largely represent human
© The Author(s) 2023. Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits
use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original
author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third
party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the mate-
rial. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or
exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://
creativecommons.org/licenses/by/4.0/.
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 2 of 13
cardiac issues. These waves include the Q wave, the R wave, the S wave, the P wave, the
T wave, and so on. The Q, R, and S waves form the QRS complex, which is concerned
with ventricular depolarization. Atrial depolarization is managed by the P wave, whereas
ventricular repolarization is the responsibility of the T wave. ECG-based heart disease
prediction relies on feature extraction and characterization after pre-processing. The
QRS complex controls ventricular depolarization. P waves depolarize atriums, whereas
T waves repolarize ventricles. Time–frequency area to display ECG frequency and time
components concurrently, or frequency space to compare QRS-complex power spec-
tra between normal and arrhythmia waveforms. In the second phase, SVM, NB, ANN,
KNN, and others were utilized to categorize. Features extraction is harder than catego-
rization since QRS complexes are hard to get. Waveform, Hermite, wavelet, and statisti-
cal characteristics are feature removal techniques [5, 6]. Decision trees, support vector
machines, key-value networks, linear discriminants, and artificial neural networks may
organize recovered characteristics [7, 8]. Most automated ECG identification techniques
use pattern-matching to describe the ECG signal as random patterns [9, 10]. They need
advanced feature removal and high sample numbers, making them laborious. Many
operations must use fewer characteristics and a lower sample rate to adopt real-time in
the hospital affordably. Perfect cardiac disease categorization has scalability, computa-
tional complexity, and efficiency challenges [11].
The QRS complex identification system had proposed in [12] based on the estimation
of the time-dependent entropy of an ECG signal. To improve the accuracy of QRS detec-
tion, entropy was computed at various temporal resolutions. Another unique technique
for detecting QRS complexes using deterministic finite automata is given in [13]. They
extracted QRS complexes and interpreted normalized ECG signals using regular grammar.
The hybrid filtering technique is used in [14] to improve the accuracy of QRS beat detec-
tion. They created derivative and maximum mean minimum hybrid filtering methods. ICA
pre-processed raw ECG data before chaos analysis recovered the QRS complex [15]. Some
cardiovascular disease categorization approaches use manmade features. DWT and Prin-
cipal Component Analysis are used in automated cardiac disease diagnosis [16]. (PCA).
DWT extracted beat characteristics and PCA reduced dimensionality in their dynamic
segmentation strategy to account for HRV. In [17], authors have reported another DWT-
based ECG wave identification and feature extraction approach. The Probabilistic Neural
Network sorted (PNN). Adaptive transformations and rational functions may extract indi-
vidual heartbeats from an ECG [18]. Raw ECG data yielded T, P, and QRS waves.
Image verification, object classification, object identification, voice recognition, and
action recognition are all common applications of deep learning algorithms. It allows
such processes to be fully automated and improved upon in terms of precision. Unsu-
pervised learning and recognition systems are the focus of current research, and deep
learning techniques are being explored to construct a multistage architecture. CNN’s
ECG-based heart disease diagnosis is one example of how deep learning techniques have
improved accuracy. By performing automated feature learning and extraction on cer-
tain ECG datasets, these approaches have increased accuracy; nonetheless, they suffer
from issues with scalability and resilience. A cardiologist’s ability to correctly catego-
rize cardiac disease using an ECG signal’s beat classification is crucial for guiding treat-
ment decisions. Information is not extracted using heartbeat-specific characteristics but
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 3 of 13
rather multi-layer automatic features used by CNN. Recently various methods have been
proposed for ECG-based disease classification using deep learning.
ECG arrhythmia classification using 2D convolutional neural networks (CNNs) is proposed
in [19]. ECG data input using STFT. A 2D CNN classified heart disorders using STFT spec-
trograms. Officially, the model was STFT-CNN. In [20], an effective deep-learning model
using time–frequency and convolutional unit presentations had proposed. The CNN learned
to automatically classify ECG data into two categories. A CNN-based architecture for ECG-
based cardiac disease categorization was suggested in [21]. The Grasshopper Optimization
Algorithm created a hybrid CNN model to eliminate artifacts and noise (GOA). Instead of
CNN features, the GOA-CNN model uses pre-processing and DWT-based feature extrac-
tion. The CNN from [22] had used in the innovative heart illness classification architecture. A
5L-CNN automatically extracted and classified raw ECG data. Recently, [23] designed a deep
learning algorithm to automatically identify and categorize illnesses using ECG data. They
predicted cardiovascular disease using 18C-CNN and raw ECG data. A state-of-the-art con-
volutional neural network approach for segmenting and identifying ECG heartbeats had pro-
posed in [24]. The rapid R-CNN model allowed simultaneous segmentation and classification.
Another study [25] employed Restricted Boltzmann Machine deep learning to classify ECG-
based arrhythmias (RBM). For ECG multi-class classification, a unique hybrid technique of
deep neural network-integrated with linear and nonlinear characteristics collected from ECG
and heart rate variability (HRV) had proposed in [26]. In [27], morphological filtering had
used to build a revolutionary classification method based on Extreme Learning Machine with
Recurrent Neural Networks (RNN). In [28], a CAD system utilizing an auto-encoder deep
learning approach had developed to automatically classify various forms of arrhythmias from
ECG data. CNN had developed in [29] to identify depression based on ECG patterns.
Deep learning approaches have surpassed semi-automatic ones in popularity, although
utilizing electrocardiograms to identify heart disease is still difficult. Using real-time
health behaviors, automatic feature extraction from raw ECG data yields erroneous con-
clusions. Directly using CNN may also loss of cardiac wave-specific and vital heartbeat
features. Also, existing methods [19–29] perform the deep learning-based classification
directly using the raw ECG signals. It leads to erroneous classification results. We use
this as motivation to provide a new framework for ECG-based cardiac disease diagnosis
that makes use of a hybrid process of feature extraction. To begin, we devise a method
for cleaning up the raw ECG data of any artifacts. We then propose a hybrid approach
to feature extraction by bringing together the Stationary Wavelet Transform (SWT) and
automated CNN features. Before feeding the hybrid data into the deep learning classifier
LSTM, manifold learning is used to minimize and normalize the features. Our hybrid
feature extraction, pre-processing, and deep learning classifier solve these problems for
ECG-based heart disease identification. Contributions are summarised here.
processed ECG data. Combining, reducing, and normalizing CNN and handcrafted
characteristics improves categorization.
• The sequential deep learning classifier called LSTM is designed for automatic heart
disease classification from the hybrid features.
• We extensively test the suggested model using state-of-the-art methods on the publi-
cally available dataset.
Proposed system
Figure 1 shows the proposed system architecture for ECG-based heart illness diagnosis.
Baseline drift, powerline interference, and other forms of noise are all eliminated from the
raw ECG signal input before further processing. In this research, we build an adaptive and
secure filtering system to achieve this goal. When the data has been cleaned and prepared,
a mixture of automated and human-driven CNN-based features are used to execute hybrid
feature extraction. The manifold learning method is employed to reduce the high-dimen-
sional features prior to normalisation, and the handcrafted and CNN features are com-
bined. The output of this block is the hybrid feature extraction performed by the proposed
architecture. With sequential input of normalised feature vectors, the LSTM classifier may
make early predictions about heart illness. Based on the likelihood score, the LSTM output
layer identifies the input ECG signal of heart disease (the class with a high probability score).
Scalability, precise QRS-complex extraction, timely disease detection, and reliable classifica-
tion are all issues that need to be addressed by the proposed integrated system.
Signal pre‑processing
The pre-processing method uses 1D median filters of various widths and 2D notch fil-
ters. 1D median filters eliminate baseline wander artefacts from input signal I to avoid
data loss. Two median filters of 200 ms and 600 ms are used to input ECG data to cor-
rect baseline wander induced by low-incidence breathing components. Instantly remov-
ing the output of both filters from the original ECG signal yields the baseline-free ECG
signal. A simple and effective second-order notch filter applied to the 60 Hz frequency
component may reduce powerline interference, another ECG artefact. Notch cutoff is
35 Hz. Two median filters with notch filtering eliminate noise, baseline drift, and power-
line interference with little processing. We’ve summarised pre-processing here.
I p2
IN = (1)
max|I p 2 |
When the signal has been normalised, a third-level NSWT decomposition is per-
formed using the Haar wavelet to provide an approximation and detailed coefficients. In
this study, we use the third-level approximation (AAA) and detailed coefficients (DDD)
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 6 of 13
to identify AQRS and DQRS, respectively. “The AQRS and DQRS beats are extracted
using the dynamic thresholding method. QRS extraction’s adaptive technique takes care
of scalability and data loss concerns. Using this method, the QRS complex is represented
by the fusion of the approximation and detailed coefficients, FAD, allowing for accurate
estimate of QRS characteristics of the input normalised ECG signal for the first time.
After obtaining the 3rd level coefficients, AAA and DDD, the dynamic thresholds T A
and T D for each coefficient are calculated as follows:”
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 7 of 13
|max(AAA)|
TA = (2)
2
|max(DDD)|
TD = (3)
2
CNN‑features extraction
An automatic method for extracting lightweight CNN features was developed once the
manual method was exhausted. Automatically extracted CNN features, or F-CNN, are
produced using an IP pre-processed ECG signal as input. To extract features from pre-
processed ECG data at minimal computational costs, we propose a 3L-CNN model, as
shown in Table 1. The first convolutional layer has a 40-element kernel, whereas the sec-
ond and third layers each have a 3-element kernel. Because of this, a lot less computa-
tion is required. “We employed batch normalisation after each 1D convolutional layer
to address the problems of parameter growth and disappearing gradients. For efficient
feature extraction in 3L-CNN, we employed 1D ReUL followed by max-pooling. The
1 × 10,000 input ECG signal is used to generate 128 × 4 features at the third layer.
Using the aforementioned 3L-CNN framework, we were able to extract the features
vector. Layers of batch normalisation, ReUL, and max pooling are combined with the 1D
convolutional layer to form the squashing layer. The final outcome of this additive bias in
the max pooling layer’s output is as follows:
Fjl = tanh pool max fjl−1 ∗ kij + bjl (4)
i
where,
• Fjl : are the feature maps produced by the ReUL l of j th max-pooling kernel
• fjl−1: are the feature maps of the previous ReUL l − 1,
• kij: are the i trained convolution kernels
• bjl : the additive bias
• pool max (·) : the max-pooling operation
• tanh(·): the hyperbolic activation function.
The final layer Fjl stored into the output variable F CNN as 2D feature vector.”
Because the number of the extracted features F Hyb is large, features selection becomes
critical in order to improve prediction accuracy while minimising computational effort.
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 8 of 13
On extracted features, we used manifold learning for feature selection. When compared
to other feature selection strategies, this technique creates trustworthy and unique fea-
tures. Using the manifold technique, the features from each vector were picked up to 50
times.
Following feature reduction, we normalise them using the log 10 technique, as follows:
F norm = −sign F Hyb ∗ log10|F Hyb | (7)
This method considerably increases the performance of heart disease diagnosis while
also assisting in reducing space and time complexity.
Classifiers
We created the LSTM sequential classifier for disease prediction and CNN for auto-
mated feature extraction in this work. Memory cells, I/O gates, forget gates, and peep-
hole connections make up covert LSTM units. LSTM, fully connected, and softmax layer
operations classify input data into two heart diseases. LSTM design uses 150 hidden lay-
ers and 27 epochs. Evaluation utilised other classifiers. We used 70% training data and
30% test data to get the final total.
Simulation results
On a computer running Windows 10 with an I3 processor and 4 GB RAM, we put the
proposed model into use and evaluated it. Every experiment is run on the PTB Diag-
nostic ECG Database, a publicly accessible research dataset [30]. This dataset is made
up of ECG data gathered from 290 people. The ECG recordings were categorized into
different categories, such as "myocardial dead tissue, myocardial infarction, and myocar-
dial infarction. Cardiomyopathy/Heart Disappointment, Pack branch square, Dysrhyth-
mia, Myocardial hypertrophy, Valvular heart disease, Myocarditis, Miscellaneous, and
Healthy Control" are all conditions that may be seen in the human body. Every ECG is
Layer 1 Conv1D (1, 64, 40, 4): BatchNorma1D (64): ReUL1D(64): Features: 64 MaxPool1D(64): kernel
Input: 1 channels Features: 64 size: 4
Output: 64 channels
kernel size: 40
Stride: 4
Layer 2 Conv1D (64, 64, 3, 4): BatchNorma1D (64): ReUL1D(64): Features: 64 MaxPool1D(64): kernel
Input: 1 channels Features: 64 size: 4
Output: 64 channels
kernel size: 4
Stride: 3
Layer 3 Conv1D (64, 128, 3, 4): BatchNorma1D (128): ReUL1D(128): Features: MaxPool1D(128): kernel
Input: 1 channels Features: 64 128 size: 4
Output: 128 channels
kernel size: 4
Stride: 3
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 9 of 13
data having a total of 15 signals which consist of 12 conservative leads and 3 Frank leads
at 1000 Hz sampled frequency. We prepared the training ECG data in 6 major classes
like Bundle Branch Block (BBB), Cardiomyopathy (CMP), Hypertrophy (HPT), Myocar-
dial Infarction (MCI), Other Heart Diseases (OHD), and Healthy Control (HC) of a total
of 530 ECG samples. Table 2 shows the number of ECG samples collected for each class.
The OHD class contains other heart diseases such as Dysrhythmia, heart failure, myo-
carditis, valvular heart disease, etc. For performance evaluation, the total dataset has
been divided into the ratio of 70% (371) training and 30% (159) testing ECG samples for
each classifier.
Using various classifiers, including LSTM, Ensemble Classifier, ANN, SVM, and KNN,
we first assess the effectiveness of the suggested hybrid method of feature extraction.
Then, using cutting-edge techniques, we give the comparison analysis. Performance met-
rics including precision, recall, accuracy, F1-score, and prediction time are measured.
The results of heart disease classification accuracy, precision, recall, and F1-score
using various classifiers are displayed in Tables 3, 4, 5, 6. These findings suggest that
FSN with LSTM outperforms other classifiers in terms of performance. It’s because,
in comparison to other classifiers, LSTM successfully solves the issues of gradient
exploding, overfitting, and class imbalance. The probabilistic LSTM classifier with
sequential hybrid characteristics as input for the early prediction of heart disease was
primarily responsible for the performance improvement. The EC classifier outper-
forms the SVM, KNN, ANN, and EC classifiers for all of these parameters because it
can reduce misclassification more effectively than the other classifiers. Among all the
classifiers, the KNN classifier has the worst performance. Another method of classi-
fier predictability analysis is shown by the F1-score parameter.
On the other hand, we contrasted the FSN features with the raw hybrid features
to demonstrate how feature normalization and selection might improve classifica-
tion performance. Using the FSN for each classifier considerably enhances the results.
The hybrid feature engineering strategy used CNN-based and handcrafted features
for disease classification efficiency. Thus, the proposed model improves classification
accuracy and F1-score parameters overall current techniques. By choosing signifi-
cant and distinctive characteristics from the high-dimensional hybrid feature vector,
manifold learning may decrease duplicate features. Multiple learning has normalized
the outcome to further decrease categorization errors. The benefits of feature nor-
malization and manifold learning decrease training and misclassification problems.
Additionally, in machine learning approaches, feature normalization performs the
straightforward procedure of distance computation. Effective weight computation
during training and classification is guided by the normalized range of all character-
istics. Table 7 shows the impact of using manifold learning in the proposed model. It
shows that applying manifold learning has improved the overall classification perfor-
mance approximately by 4%.
We conclude by comparing the proposed model to state-of-the-art deep learning
algorithms for ECG-based cardiac disease classification based on their performance.
We’ve employed several cutting-edge methods including STFT-CNN [20], GOA-CNN
[21], 5L-CNN [22], and 18C-CNN [23]. Table 8 displays the average training-detec-
tion time, accuracy, and F1 score. This comparison suggests that the proposed cardiac
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 10 of 13
1 BBB 17
2 CMP 16
3 HPT 7
4 MCI 377
5 OHD 33
6 HC 80
Total samples 530
Table 7 Proposed model analysis with manifold and without manifold learning
Measures Without manifold learning With
manifold
learning
methods. We recommend looking at more data sets in the future to see how reliable the
proposed model’s performance is.
Acknowledgements
I am grateful to all of those with whom I have had the pleasure to work during the completion of the entire experiment.
Author contributions
Have written the entire paper after performing the experimental results. Have reviewed the entire paper and guided in
performing the experimental results and writing the manuscript.
Funding
This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
Declarations
Ethics approval and consent to participate
This article does not contain any studies with human participants performed by any of the authors.
Competing interests
The authors declare that they have no known competing financial interests or personal relationships that could have
appeared to influence the work reported in this paper.
References
1. Ponikowski P, Anker SD, AlHabib KF, Cowie MR, Force TL, Hu S, Jaarsma T, Krum H, Rastogi V, Rohde LE, Samal UC,
Shimokawa H, Siswanto BB, Sliwa K, Filippatos G. Heart failure: preventing disease and death worldwide. ESC Heart
Fail. 2014;1(1):4–25. https://doi.org/10.1002/ehf2.12005.
2. Mahajan HB, Badarla A, Junnarkar AA. CL-IoT: cross-layer Internet of Things protocol for intelligent manufacturing of
smart farming. J Ambient Intell Human Comput. 2020. https://doi.org/10.1007/s12652-020-02502-0.
3. Rajpurkar P, Hannun AY, Haghpanahi M, Bourn C, Andrew A. Cardiologist-level arrhythmia detection with convolu-
tional neural networks. 2017.
4. Mahajan HB, Badarla A. Application of internet of things for smart precision farming: solutions and challenges. Int J
Adv Sci Technol. 2018;2018:37–45.
5. deChazal P, O’Dwyer M, Reilly RB. Automatic classification of heartbeats using ECG morphology and heartbeat
interval features. IEEE Trans Biomed Eng. 2004;51(7):1196–206. https://doi.org/10.1109/tbme.2004.827359.
6. Lagerholm M, Peterson C, Braccini G, Edenbrandt L, Sornmo L. Clustering ECG complexes using Hermite functions
and self-organizing maps. IEEE Trans Biomed Eng. 2000;47(7):838–48. https://doi.org/10.1109/10.846677.
7. Ince T, Kiranyaz S, Gabbouj M. A generic and robust system for automated patient-specific classification of ECG
signals. IEEE Trans Biomed Eng. 2009;56(5):1415–26. https://doi.org/10.1109/tbme.2009.2013934.
8. De Lannoy G, Francois D, Delbeke J, Verleysen M. Weighted conditional random fields for supervised interpatient
heartbeat classification. IEEE Trans Biomed Eng. 2012;59(1):241–7. https://doi.org/10.1109/tbme.2011.2171037.
9. Rodríguez J, Goni A, Illarramendi A. Real-time classification of ECGs on a PDA. Inf Technol Bio Med IEEE Trans.
2005;9:23–34. https://doi.org/10.1109/TITB.2004.838369.
10. Jung W-H, Lee S-G. An arrhythmia classification method in utilizing the weighted KNN and the fitness rule. IRBM.
2017;38(3):138–48. https://doi.org/10.1016/j.irbm.2017.04.002.
11. Jiang W, Seong Kong G. Block-based neural networks for personalized ECG signal classification. IEEE Trans Neural
Netw. 2007;18(6):1750–61. https://doi.org/10.1109/tnn.2007.900239.
12. Farashi S. A multiresolution time-dependent entropy method for QRS complex detection. Biomed Signal Process
Control. 2016;24:63–71. https://doi.org/10.1016/j.bspc.2015.09.008.
13. Hamdi S, Ben Abdallah A, Bedoui MH. Real time QRS complex detection using DFA and regular grammar. BioMedical
Eng OnLine. 2017. https://doi.org/10.1186/s12938-017-0322-2.
14. Sheetal A, Singh H, Kaur A. QRS detection of ECG signal using hybrid derivative and MaMeMi filter by effec-
tively eliminating the baseline wander. Analog Integr Circ Sig Process. 2019;98:1–9. https://doi.org/10.1007/
s10470-018-1249-7.
15. Gupta V, Mittal M, Mittal V. R-peak detection based chaos analysis of ECG signal. Analog Integr Circ Sig Process.
2020;102:479–90. https://doi.org/10.1007/s10470-019-01556-1.
16. El-Saadawy, Hadeer. (2017). Heart disease diagnosis using Electrocar-diogram (ECG) Signal Processing. https://doi.
org/10.3923/ajit.2017.771.782.
Golande and Pavankumar Journal of Big Data (2023) 10:139 Page 13 of 13
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.