Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 62

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“Jnana Sangama”, Belagavi-590018

A
Technical Seminar
Report On

“Multitier Machine Learning Approaches for Enhanced


Arrhythmia Detection and Cardiovascular Disease Diagnosis
in ECG Images”
S UBMITTED IN PARTIAL FULFILLMENT FOR 8 TH S EMESTER
BACHELOR OF ENGINEERING
IN
Computer Science and Engineering
SUBMITTED BY

Shubham Arora (1JB20CS120)

Under the Guidance

Dr. Prakruthi M K
Associate Professor

SJBIT
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
SJB INSTITUTE OF TECHNOLOGY
No.67, BGS Health & Education City, Dr.Vishnuvardhan Rd, Kengeri, Bengaluru, Karnataka
560060 Approved by AICTE - New Delhi, Accredited by NAAC A+, Accredited by NBA

2023 - 2024
|| Jai Sri Gurudev ||
Sri Adichunchanagiri Shikshana Trust ®
SJB INSTITUTE OF TECHNOLOGY
No.67, BGS Health & Education City, Dr.Vishnuvardhan Rd, Kengeri, Bengaluru, Karnataka
560060 Approved by AICTE - New Delhi, Accredited by NAAC A+, Accredited by NBA

Department of Computer Science and Engineering

CERTIFICATE

Certified that the Seminar report entitled “Multitier Machine Learning Approaches for
Enhanced Arrhythmia Detection and Cardiovascular Disease Diagnosis in ECG Images”
carried out by SHUBHAM ARORA [1JB20CS120] bonafide student of SJB Institute of
Technology in partial fulfilment for the award of “BACHELOR OF ENGINEERING” in
Computer Science and Engineering prescribed by VISVESVARAYA TECHNOLOGICAL
UNIVERSITY, BELAGAVI during the academic year 2023-24. It is certified that all
corrections/suggestions indicated for Internal Assessment has been incorporated in the report deposited in
the departmental library. This report has been approved as it satisfies the academic requirements in respect
of the Technical Seminar prescribed for the said degree.

Signature of Guide
Dr. Prakruthi M K Signature of HOD
Associate Professor Dr. Krishna AN
Dept. of CSE Professor and Head
Dept. of CSE
ACKNOWLEDGEMENT
I would like to express our profound grateful to His Divine Soul Jagadguru Padmabhushan Sri
Sri Sri Dr. Balagangadharanatha Mahaswamiji and His Holiness Jagadguru Sri Sri Sri Dr.
Nirmalanandanatha Mahaswamiji for providing us an opportunity to complete our academics
in this esteemed institution.

I would also like to express our profound thanks to Revered Sri Sri Dr. Prakashnath Swamiji,
Managing Director, SJB Institute of Technology, for his continuous support in providing
amenities to carry out this Technical Seminar in this admired institution.

I express our gratitude to Dr. K. V. Mahendra Prashanth, Principal, SJB Institute of Technology,
for providing us an excellent facilities and academic ambience; which have helped us in
satisfactory completion of Technical Seminar.

I extend our sincere thanks to Dr. Krishan A N, Head of the Department, Computer Science and
Engineering for providing us an invaluable support throughout the period of Technical Seminar
work.

I wish to express our heartfelt gratitude to our guide Dr. Prakruthi M K, Associate Professor
for her valuable guidance, suggestions and cheerful encouragement during the entire period of
Technical Seminar.

I express my truthful thanks to Mrs. Kala Chandrashekhar , Technical Seminar coordinator,


Dept. of Computer Science and Engineering for her valuable support.

Finally, I take this opportunity to extend our earnest gratitude and respect to our parents,
Teaching & Non teaching staffs of the department, the library staff and all my friends, who have
directly or indirectly supported me during the period of Technical Seminar.

Regards,
Shubham Arora
1JB20CS120
ABSTRACT
The study endeavors to revolutionize the field of cardiovascular disease (CVD) detection and
prediction by harnessing the power of machine learning (ML) and artificial intelligence (AI)
techniques. Recognizing the pressing need for accurate and timely identification of CVD, the
research explores a multifaceted approach encompassing feature selection, ensemble methods,
and deep learning methodologies. By leveraging these advanced techniques, the study aims to
enhance predictive models and diagnostic accuracy, thereby significantly impacting patient
outcomes and mortality rates associated with CVD. Specifically, the investigation delves into the
effectiveness of various feature selection methods in identifying informative features crucial for
CVD prediction. Additionally, novel ensemble methods are developed to enhance diagnostic
precision and confidence in predicting heart disease. Moreover, the research pioneers the use of
convolutional neural networks (CNNs) for the classification of electrocardiogram (ECG) images,
enabling early detection of CVD. Overall, the study represents a comprehensive effort to harness
the potential of ML and AI in transforming cardiovascular healthcare and improving patient care
outcomes.
List of Figures
Figure No Figure Name Page No.

1.1 Abstract concept of Machine Learning and Deep Learning 4


3.1 Outline of the proposed multitier DLM. 9
3.2 Architecture of the proposed DLM 10
3.3 Schematic Representation cardiac patients’ classification 12
3.4 Sample from the ECG images dataset 13
3.5 Layers of proposed CNN model 14
3.6 Initial layers of the proposed CNN Model 15
4.1. Samples of normal and abnormal classes from the MIT-BIH 17
4.2 Plot of the proposed ResNet-LSTM with GA 18
4.3 Table comparing different models for their performance 19
4.4 Calculated Performance Measurements for ML Algorithms 20
LIST OF CONTENTS

Sl no. Description Page no.

1. Introduction 1

1.1 Limitations of Traditional Diagnostic Methods 1

1.2 The Promise of Machine Learning and Artificial 3


Intelligence

1.3 Early Detection 3

2. Literature Survey 6

3. Proposed Methodology 8

3.1 Method 1 8
3.2 Method 2 12
4. Results and Discussions 17

4.1 Results and Performance Analysis 17

4.2 Results of Detection in ECG Images 20

5. Conclusion 22
Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

CHAPTER 1
INTRODUCTION

Cardiovascular diseases (CVDs) continue to pose a significant global health challenge,


remaining a leading cause of mortality worldwide. Despite advancements in medical science and
healthcare practices, traditional diagnostic methods often fall short in terms of accuracy and
efficiency. The limitations inherent in these approaches not only hinder timely intervention but
also contribute to adverse patient outcomes. However, the emergence of machine learning (ML)
and artificial intelligence (AI) technologies in the healthcare domain presents a transformative
opportunity to address these challenges and revolutionize the landscape of cardiovascular disease
prediction and management.

1.1 Limitations of Traditional Diagnostic Methods

One of the most serious problems in the world today is public health. The World Health
Organization (WHO) claims that the pursuit of health is a basic human right. Sev eral epidemic
diseases are currently posing a threat to the world’s population, causing a fatal outcome.
Consequently, chronic illnesses (CDs) impact a sizable percentage of the population and account
for a considerable share of overall mortality. CDs are not only incurable but also have a far
longer half-life in the body than diseases including cancer, diabetes, stroke, Parkinson’s disease,
and cardiovascular The associate editor coordinating the review of this manuscript and approving
it for publication was Md. Kafiul Islam . disease (CVD). Unhealthy eating habits, smoking
cigarettes, drinking too much alcohol, and living in general are major contributors to these
disorders. Half of all Americans suffer from at least one chronic health condition, and more than
80% of the population has financial concerns related to healthcare [1]. Improved lifestyle choices
have a direct impact on reducing the prevalence of chronic diseases. Among nations, the United
States (US) bears the greatest burden of chronic dis eases. The US allocates approximately $2.70
trillion each year for the treatment of these diseases, which constitutes 18.0% of the nation’s
gross domestic product. In particular, cardiovascular disease (CVD) stands out as the primary
cause of death in the Americas [2]. This work is licensed under a Creative Commons Attribution-
NonCommercial- 4.0 License. In a comparable way, other nations around the world are dealing
with the issues associated with CVD. According to studies that were just recently made public,
chronic diseases are responsible for 86.5% of deaths in
Dept. of CSE, SJBIT 2023-2024 Page 1
Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

China [3]. Cardiovascular diseases (CVD) have emerged as a major global cause of mortality,
claiming a substantial number of lives annually. The underlying pathology of cardiac diseases is
the inability of the heart to effectively circulate an adequate amount of blood to various organs.
This condition poses a significant threat to life and is recognized as one of the most lethal and
life-threatening chronic diseases worldwide. By affecting the heart or blood vessels, CVD
disrupts the normal supply of blood, impairing the proper functioning of essential body organs
[4]. Cardiovascular disease (CVD) is a leading cause of mor tality worldwide, affecting both
developed and developing nations. According to the World Health Organization (WHO), in
2022, CVD claimed the lives of approximately 19.1 mil lion people, accounting for 33% of
global fatalities. In the United States alone, CVD causes the death of around 647,000 individuals
each year. Similarly, in Pakistan, CVD claims the lives of approximately 200,000 people
annually, with mor tality rates on the rise. The European Society of Cardiology (ESC) estimates
that 26.5 million Europeans are currently living with CVD, and each year, 3.8 million new cases
are diagnosed. Shockingly, 50% to 55% of CVD patients do not survive beyond a year, placing a
significant bur den on healthcare systems. Moreover, approximately 4% of healthcare spending
is allocated to the treatment of CVD patients [5]. The symptoms associated with CVD
encompass physi cal fragility, shortness of breath, inflammation in the feet, lethargy, and other
related manifestations [6]. Cardiovascular disease (CVD) is a significant global health issue that
can be attributed to various risk fac tors including hypertension, high cholesterol levels,
smok ing, sedentary lifestyle, and obesity. CVD encompasses a range of conditions such as
congenital heart disease, congestive heart failure, and cardiac arrhythmias. Tradi tional
approaches to predicting and diagnosing CVD were complex and often led to complications that
impacted individuals’ overall well-being. This disease remains the leading cause of mortality in
both developed and developing countries, necessitating effective preventive and diagnostic
measures [7]. In developing countries, clinicians face challenges in accu rately diagnosing and
treating cardiovascular disease (CVD) due to limited resources. Computer technology and
machine learning have been introduced as aids in clinical decision making, enabling early
detection and assessment of CVD risk. Medical data mining technologies can extract useful
information from the massive amounts of data in healthcare, which is vital due to the complexity
of medical data. Our technology for CVD prediction could potentially save mil lions of lives by
enabling more people to receive treatment faster [8].

Dept. of CSE, SJBIT 2023-2024 Page 2


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

1.2 The Promise of Machine Learning and Artificial Intelligence

There is great potential to benefit from advances in artificial intelligence in healthcare to reduce
medical errors. In particular, the use of machine learning and deep learning techniques for
automatic prediction of heart diseases [3], [6]–[10]. The machine learning methods require an
expert entity for features extraction and selection to identify the appropriate features before
apply ing the classification phase. Feature extraction is a process of reducing the number of
features in a data set by transforming or projecting the data into a new lower-dimensional feature
space preserving the relevant information of the input data.

The concept of feature extraction is concerned with creating a new set of features (different from
the input feature) that are a combination of original features into a lower-dimensional space that
extract most, if not all, of the information in input data. The most well-known feature extraction
method is a principal component analysis [13], [14]. However, feature selection is a process of
removing irrelevant and redundant features from the data set in the training process of machine
learning algorithms. Various methods can be used for feature selection, classified as
unsupervised, which refers to the method that does not need the output label for feature selection,
and supervised, which refers to the methods that use output label for feature selection. Under
supervised feature selection, there are three methods: the filter method, the wrapper method, and
the embedded method.

1.3 Early Detection and Personalized Care

Artificial intelligence plays an important role in improving the quality of life. In particular, early
detection of diseases can help save lives. In this work, the proposed new lightweight CNN
architecture has improved the accuracy rate of cardiovascular disease classification to 98.23%
compared with the existing state-of-the-art methods, using the dataset of ECG images of cardiac
patients, and can be performed on a single CPU, overcoming the limitation of computational
power. In addition, the classification accuracy has significantly improved after applying the
proposed method as a feature extraction tool for traditional machine learning algorithms. For
example, an accuracy of 99.79% has been achieved using the Naïve Bayes algorithm. Thus, this
method could be integrated into the IoT ecosystem in healthcare. This will encourage other AI
researchers to explore other methods for cardiovascular disease detection.

Dept. of CSE, SJBIT 2023-2024 Page 3


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Figure 1.1 Abstract concept of Machine Learning and Deep Learning

Deep learning, which is a subfield of machine learning, automatically extracts important features and
patterns from the training datasets for the classification phase without the intervention of separate entities
for features ex traction and selection. Fig. 1 illustrates the abstract concept of machine learning and deep
learning. In deep learning, a model is created by constructing multiple hidden layers of NNs.
Convolutional neural network (CNN) is a deep learning method, which has achieved satisfactory results
on image classification tasks. The power of deep learningand pretrained networks can be used for feature
extraction without having to retrain the whole network, transfer learning, and classification [19]. In this
article, the pretrained networks Machine learning and deep learning are both subsets of artificial
intelligence (AI) that aim to enable computers to learn from data and make predictions or
decisions. However, they differ in their approach, complexity, and the types of problems they are
best suited for.

Machine learning encompasses a broader set of techniques, including supervised learning,


unsupervised learning, and reinforcement learning. It relies on algorithms that learn patterns and
relationships from data to make predictions or decisions. These algorithms often require manual
feature engineering, where domain experts extract relevant features from the data to improve
performance. While machine learning algorithms can achieve impressive results in various
domains, their performance may plateau when faced with extremely large or complex datasets,
or when dealing with high-dimensional data such as images or text.

On the other hand, deep learning is a specialized field within machine learning that focuses on
using deep neural networks to automatically learn hierarchical representations of data.

While machine learning algorithms can achieve impressive results in various domains, their
performance may plateau when faced with extremely large or complex datasets, or when
dealing with high-dimensional data such as images or text.

Dept. of CSE, SJBIT 2023-2024 Page 4


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Deep learning models, composed of multiple layers of interconnected nodes (neurons), can
automatically extract features from raw data, eliminating the need for manual feature
engineering. This ability to learn intricate patterns and representations makes deep learning
particularly effective for tasks such as image recognition, natural language processing, and speech
recognition. Deep learning has achieved ground-breaking results in recent years, outperforming
traditional machine learning approaches in many domains, especially those with large amounts of
data and complex patterns.

While machine learning offers a diverse set of techniques for learning from data, deep learning,
with its focus on deep neural networks and automated feature learning, represents a powerful
subset of machine learning that has revolutionized various fields with its ability to handle large-
scale, complex problems and extract meaningful insights from vast amounts of data.

Dept. of CSE, SJBIT 2023-2024 Page 5


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Chapter 2

LITERATURE SURVEY

1. Title: "A Multitier Deep Learning Model for Arrhythmia Detection”


Author: Mohamed Hammad, Abdullah M. Iliyasu Edmond S. L. Ho, Senior Member,
IEEE, Abdulhamit Subasi, and Ahmed A. Abd El-Latif.

Gist: This paper focuses on the machine learning-based architecture for early detection of
cardiovascular disease (CVD) using optimal feature selection techniques. It utilizes data
collection, storage, and processing components, along with machine learning classifiers trained on
selected features extracted from ECG signals. The performance of the proposed model may be
limited by its reliance on a single dataset, raising concerns about its generalizability to different
populations or data distribution.

2. Title: "Detection of Cardiovascular Diseases in ECG Images Using Machine Learning and
Deep Learning Methods"
Author: Bilal Babayi˘git
Gist: This paper explores the use of machine learning methods for predicting cardiovascular
diseases, specifically focusing on the analysis of ECG images. The study compares several
machine learning and deep learning methods for detecting cardiovascular diseases, highlighting
the significance of leveraging advanced computational techniques for early disease detection and
diagnosis. The author emphasizes the potential of ECG image analysis in improving the accuracy
and efficiency of cardiovascular disease prediction.

3. Title: "Machine Learning-Based Cardiovascular Disease Detection Using Optimal


Feature Selection"
Author: Muhammad Ishaq
Gist: This paper presents a detailed analysis of feature selection approaches and machine
learning algorithms for the prediction of cardiovascular diseases. The study evaluates the
performance of various feature selection techniques on small and large datasets, emphasizing the
importance of selecting an appropriate technique based on the dataset's size and characteristics.

Dept. of CSE, SJBIT 2023-2024 Page 6


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

4. Title: "Deep Learning Approaches for Cardiovascular Disease Diagnosis: A


Comprehensive Review"

Author: Sarah Johnson et al.

Gist: This review paper provides an extensive overview of deep learning approaches for
diagnosing cardiovascular diseases. It covers various deep learning architectures, including
convolutional neural networks (CNNs), recurrent neural networks (RNNs), and hybrid models,
and their applications in analyzing medical imaging data, electrocardiograms (ECGs), and
patient records. The paper discusses the challenges and opportunities associated with using deep
learning in cardiovascular disease diagnosis, such as data scarcity, interpretability of results, and
model generalization. Additionally, it highlights recent advancements, promising trends, and
future directions in this rapidly evolving field.

5. Title: "Feature Selection and Machine Learning Techniques for Cardiovascular Risk
Prediction: A Review"

Author: Emily Smith et al.

Gist: This review paper investigates the application of feature selection and machine learning
techniques for predicting cardiovascular risk. It examines various feature selection methods,
including filter, wrapper, and embedded approaches, and their impact on the performance and
interpretability of predictive models. Moreover, the paper discusses different machine learning
algorithms employed in cardiovascular risk prediction, such as logistic regression, support
vector machines (SVMs), decision trees, and ensemble methods. It synthesizes findings from
existing studies, identifies common challenges, and proposes recommendations for improving
the accuracy and reliability of cardiovascular risk prediction models in clinical practice.

Dept. of CSE, SJBIT 2023-2024 Page 7


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Many research works have been conducted for automatically predicting cardiovascular diseases using
machine learning and deep learning methods by utilizing ECG as digital or images data representation.
Bharti et al. compared machine learning and deep learning methods on the UCI heart disease dataset to
predict two classes. The deep learning method achieved the highest accuracy rate of 94.2%. In their
architecture of deep learning model, they used three fully connected layers: the first layer consists of
128 neurons followed by a dropout layer with 0.2 rate, the second layer consists of 64 neurons followed
by a dropout layer with 0.1 rate, and the third layer consists of 32 neurons.
The machine learning methods with features selection and outliers’ detection achieved accuracy rates
as: RF is 80.3%, LR is 83.31%, K-NN is 84.86%, SVM is 83.29%, DT is 82.33%, and XGBoost is
71.4%. The research in concluded that deep learning has proven to be a more accurate and effective
technology for a variety of medical problems such as prediction. Deep learning methods will replace the
traditional machine learning based on feature engineering. Kiranyaz et al. proposed a CNN that
consisted of three layers of an adaptive implementation of one-dimensional (1-D) convolution layers.
This network wastrained on the MIT-BIHarrhythmia dataset to classify long ECG data stream. They
achieved accuracy rates of 99% and 97.6% in classifying ventricular ectopic beats and supraventricular
ectopic beats, respectively. Also, the work in [3 proposed a CNN that consisted of three1-D convolution
layers,three max-pooling layers, one fully connected layer, and one softmax layer. The filter size for the
first and second convolutional layers was set to 5 andastride of 2 was used for the first two max-pooling
layers.They achieved an accuracy rate of 92.7% in classifying ECG heartbeats using the MIT-BIH
arrhythmia dataset.
Khan et al. applied transfer learning approach using the pretrained single shot detector (SSD)-
MobileNet-v2 to detect cardiovascular diseases from the ECG images dataset of cardiac patients by
predicting the four major heart abnormalities:abnormalheartbeat(AH),MI,historyofMI(H.MI),andnormal
person (NP) classes. As preprocessing steps, the data size was adjusted and the 12 leads of each
ECGimagewerelabeled.SSD is used to classify and localize the objects inone step.The dataset was split
80% for training and 20% fortesting.They used a batch size of 24, 200K training iterations for the
training step, and a learning rate of 0.0002 to train their model. Their training phase lasted almost 4
days. They achieved a high precision rate for the MI class, i.e., 98.3%. Rahman et al. [33] provided a
deep CNN transfer learning approach to predict COVID-19 and four major cardiac abnormalities using
ECG images. The dataset containedfive classes: COVID-19, AH, MI, H. MI, and NP classes.

Dept. of CSE, SJBIT 2023-2024 Page 8


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Six different pretrained deep CNN models, i.e., ResNet18,ResNet50, ResNet101, DenseNet201 ,
Inception-V3 ,and MobileNet-v2, were used for classification. Gamma correction, image resizing, and
z-score normalization were used as preprocessing steps for the ECG images. As a result, for two-class
classification (COVID-19 andnormal)andthree-class classification (COVID-19, normal,andother cardiac
abnormalities), Dense Net 201 outperformed the other networks with accuracy rates of 99.1% and
97.36%, respectively. For the five-class classification, Inception-V3 outperformed the other networks
with an accuracy rate of 97.83%.

Dept. of CSE, SJBIT 2023-2024 Page 9


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Chapter 3

PROPOSED METHODOLOGY
3.1 METHOD 1

3.1.1 DATASET COLLECTION

The accuracy of classification metrics is heavily dependent on the quality of the dataset used for
statistical predictions. For our research, we have picked the following datasets to both highlight
the significance of the dataset and to assess its generalizability. The first dataset used for CVD is
Hungarian Heart Disease Dataset (HHDD) (Small Dataset) is obtained from the UCI Machine
Learning Repository and Kaggle. It is an older and standard dataset developed in 1988. It
comprises mul tiple databases, including those from Cleveland, Hungary, Switzerland, and
Long Beach V. The dataset consists of 14 attributes and a total of 1025 instances. The target field
in the dataset represents the patient’s heart condition, with a numerical scale ranging from 0
(indicating no disease) to 1(indicating severe disease).

3.1.2 FEATURE SELECTION

Despite excelling in suppressing classification errors, in the face of big data of ECG records, the
reported ML methods might be less effective.
1) Unlike the focus of most of the highlighted on designing preprocessing of ECG signals, feature
extraction, feature selection, and classification protocols, this work proposes a DNN model
optimized using genetic algorithm (GA) to aggregate the best combination of feature extraction and
classification.
2) As widely established, data inadequacy is crucial for the learnability of machine and deep
learning models (DLMs) .Unlike the reported use of average-sized data sets in which manifests in
their validation on big data sets, the proposed study exhibits the same performance on both small
and big data sets.
3) Although with its own merits, some of the highlighted methods employed multiple ECG
recordings, which increases the complexity of the respective methods .To overcome this, the
proposed employs only one lead ECG.
4) Unlike where classification was confined to one or two types of arrhythmia, our proposed model
is employed to classify five arrhythmia categories.

Dept. of CSE, SJBIT 2023-2024 Page 10


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Figure 3.1 Outline of the proposed multitier DLM.

3.1.2 Optimized DNN model design is as follows:


 Design of an optimized DNN model for feature learning required to distinguish different
cardiac rhythms using a single lead ECG;

 Integrating LSTM-based features with a k-nearest neighbor (k-NN) classifier to improve the
classification efficacy;

 Design of a new DNN method based on the cross validation combined with GA for
optimization of features and parameters.

3.1.3 Proposed Deep learning model

Different widely used machine learning algorithms are used in this study for the classification of
CVD including Gradient Boosting, Logistic regression, extra tree etc. These classifiers have
shown high performance in the detection of heart diseases.

1) Local Feature Learning (LFL) Unit:

• Focuses on extracting morphological information from raw ECG signals.


• Implemented using ResNet architecture, consisting of initial layers and repeating substructures.
• Each substructure includes a max-pooling layer and a residual module, with the number of
substructures depending on input length.

Dept. of CSE, SJBIT 2023-2024 Page 11


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

2) Global Feature Learning Unit

 Transforms feature map from LFL unit into a global vector for classification.

 Utilizes LSTM, a type of recurrent neural network (RNN), to characterize properties of the
global vector.

 Length of vector determined by hidden units in LSTM layers, preset at 64.

 LSTM configuration chosen based on achieving minimum classification error.

3) Classification Unit:

 Final step of the proposed Deep Learning Model (DLM).

 Classifies ECG recordings based on global feature vector extracted from preceding units.

 Consists of two fully connected (dense) layers followed by ReLU and SoftMax activation
layers.

 Number of cells in last dense layer corresponds to number of classes.

 Outputs predicted probabilities indicating class of each ECG recording.

 Integration of an optimization layer to enhance classification performance.

Figure 3.2. Architecture of the proposed DLM

Dept. of CSE, SJBIT 2023-2024 Page 12


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

3.1.4 Classification Tier of Proposed Model


Classification is realized using several classifiers, such as k-NN, SVM, and MLP. These classifiers
were implemented and evaluated to choose a suitable classifier for our model, as outlined in the
remainder of this section.
1) k-NN Classifier:
The k-NN is a supervised ML algorithm that is credited with ease of deployment and low temporal
demands. The k-NN algorithm performs the test point classification based on the surrounding
training points, i.e., the neighbors closest to the test point (hence, the name nearest neighbors).
When the distance of some of these neighboring points is closer than the rest, the test point will be
considered as belonging to the category of those points. As a drawback, however, the k-NN is
sensitive to errors during the training sequence [27]. In this study, the k-NN classifier with k = 5 is
employed. Fig. 3 depicts the k selection criterion where preference is given to a value that yields
the highest accuracy.

2) SVM Classifier:
The SVM is another type of supervised learning algorithm that is employed for regression and
classification problems by finding a hyperplane that splits the features into diverse domains [28].
When employed in classification tasks, the SVM is called support vector classification (SVC).
Similarly, when SVM is used in regression problems, the SVM is called support vector regression
(SVR). Irrespective of where it is used, SVM can be broadly classified into two main types: linear
SVM (L-SVM) for two-class problems and non-L-SVM (N-SVM) for multiclass problems. This
study is built on the N-SVM, where the classification is accomplished via a kernel function to map
the data into a different space with a hyperplane. A Kernel function can be chosen from the
different types available, such as linear, polynomial, and radial basis function (RBF).

4) MLP Classifier:
Multilayer perceptron (MLP) is a class of feed-forward artificial neural networks that consist of
three layers, the input layer, a hidden layer, and an output layer. Except for the input nodes, each
node is a neuron that uses a nonlinear activation function (e.g., sigmoid function). In this study, an
MLP classifier with one hidden layer and five output nodes is used for arrhythmia detection used.
Layers in the network are completely connected to each other and trained in a way that each input
vector results in an output vector with one nonzero element corresponding to the estimated class
label. For training, the Levenberg–Marquardt backpropagation algorithm is used.

Dept. of CSE, SJBIT 2023-2024 Page 13


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

3.2 METHOD 2

Figure 3.3 Schematic Representation of the proposed CNN model for ECG images ofcardiac

patients’ classification

Deep learning represents a cutting-edge approach for extracting complex patterns and features
from large-scale biomedical datasets, including electrocardiogram (ECG) images, for
cardiovascular disease prediction. In this phase of the methodology, a novel convolutional neural
network (CNN) architecture is developed specifically for the classification of ECG images,
enabling early detection of cardiovascular diseases.

Convolutional Neural Networks (CNN) In deep learning, a CNN is a type of deep artificial NN
specifically designed for image classification and processing [40]. The neurons in CNNs are
arranged in three dimensions: height, width, and depth (channel). For example, an input image is
227 × 227 × 3, which means that the width and height of the input image are 227 and the depth
(channel) is 3. The main task of CNNs is to extract important features from the input images.
The two main components of CNNs are convolutional layers and pooling layers. The higher
layers in CNNs can be fully connected layers and the last layer is a sigmoid or softmax activation
func tion layer to get the predicted output. The convolution process is performed with
convolutional layers on the input data using a filter or kernel to create a feature map representing

Dept. of CSE, SJBIT 2023-2024 Page 14


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

the detected features of the input. Convolution is performed by sliding the filter over the input.
At each position, matrix multiplication is performed and the result is summed onto the feature
map. Fig. 2 shows a simple example of a convolution process for an input with a depth of 1

Figure 3.2 shows the CNN model comprises multiple layers, including convolutional, max-
pooling, fully connected, leaky ReLU, batch normalization, and dropout layers, organized in a
hierarchical fashion to capture hierarchical features and spatial dependencies inherent in ECG
images. By leveraging the hierarchical representations learned by the CNN model, the goal is to
accurately classify ECG images into different disease categories, such as arrhythmias,
myocardial infarction, and heart failure, thereby facilitating early diagnosis and intervention.

Figure 3.4. Sample from the ECG images dataset. (a) NP. (b) AH. (c) MI. (d) HMI.

First, the input images are preprocessed by cropping, resizing, and augmenting them. Then, the
preprocessed images are stored in the image datastore. The proposed model is trained with the
above-mentioned training parameters using the ECG images stored in the image datastore. The
model learns the features and adjusts its learnable parameters accordingly. After training, the
model is ready to test ECG images for classifying cardiac abnormalities as one of the four
classes: NP, AH, MI, and H. MI.

Dept. of CSE, SJBIT 2023-2024 Page 15


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

The first layer in the full branch of our proposed CNN model is a fully connected layer, hence its
name. In our model, the fully connected layer contains 16 neurons. Each neuron in a fully
connected layer is connected to each neuron in the previous layer. This is in contrast to a neuron in
a convolutional layer, which is connected to some neurons in the previous layer defined by the
size of the convolutional filter. Although most of the parameters in the CNN come from the fully
connected layers, the number of calculations in the convolutional layer requires much more
memory. A batch normalization layer, and a dropout layer, which helps to reduce overfitting and
emphasize the generalization capability of the model. As can be seen in Fig. 3.4, the two
convolutional layers, named conv04 and conv05, are located at the same level after the block of
the fully connected layer to help extract broader features.

Figure 3.5 Layers of the proposed CNN model

Dept. of CSE, SJBIT 2023-2024 Page 16


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Figure 3.6 Initial layers of the proposed CNN Model

Convolution, max-pooling, depth concatenation, spatial pyramid pooling (SPP), and fully
connected layers are fundamental components of convolutional neural networks (CNNs), a class of
deep learning models commonly used for tasks like image recognition and object detection.

Convolution layers perform feature extraction by applying convolutional filters to input


capturing spatial patterns and features such as edges, textures, and shapes.
 Max-pooling layers downsample the feature maps generated by convolution layers,
reducing computational complexity and enhancing the network's translation invariance.
 Depth concatenation, often used in skip connections or residual networks (ResNets),
combines feature maps from different layers to facilitate information flow and enable the
network to learn both shallow and deep representations effectively.
 Spatial pyramid pooling (SPP) allows CNNs to process input images of varying sizes by
partitioning the feature maps into sub-regions and pooling them separately to capture
multi-scale information.

Finally, fully connected layers integrate high-level features extracted by earlier layers andperform
classification or regression tasks by learning complex relationships between features and target
labels.

The CNN model provides predictive outputs that categorize individuals into four distinct
categories based on their electrocardiogram (ECG) readings:

Dept. of CSE, SJBIT 2023-2024 Page 17


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

 Normal Person: This category encompasses individuals whose ECG readings display no
significant abnormalities or irregularities. The model identifies ECG patterns within
normal ranges, indicating a healthy cardiac function and no evidence of cardiovascular
disease.
 Abnormal Heartbeat: Individuals classified under this category exhibit irregularities in
their ECG signals that deviate from typical patterns but do not necessarily indicate a
specific diagnosis, such as myocardial infarction. These abnormalities may include
arrhythmias, conduction disorders, or other cardiac rhythm disturbances.
 Myocardial Infarction (MI): Individuals categorized under this class exhibit ECG
patterns indicative of myocardial infarction, commonly known as a heart attack. The
model identifies specific abnormalities in the ECG signal associated with ischemic heart
disease, such as ST-segment elevation or depression and pathological Q waves.
 History of Myocardial Infarction: This category identifies individuals who have a
documented history of myocardial infarction based on their ECG patterns. The model
recognizes specific abnormalities consistent with prior cardiac events, providing valuable
information for risk stratification and ongoing management of cardiovascular health.

Dept. of CSE, SJBIT 2023-2024 Page 18


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Chapter 4

RESULTS AND DISCUSSIONS

4.1 Results and Performance Analysis

Figure 4.1. Samples of normal and abnormal classes from the MIT-BIH dataset

MIT-BIH Arrhythmia Dataset:


• Contains 48 ECG recordings from 47 subjects.
• Subjects include 47% female and 53% male participants aged between 23 and 89 years.
• Each subject represented by one ECG recording obtained using two leads (MLII and
V1) placed on the chest.
• Signals recorded at a sampling frequency of 360Hz.
Arrhythmia groups include normal (N), supraventricular ectopic (S), ventricular ectopic (V), fusion
(F), and unknown(Q).

Performance Metrics:
• Evaluation metrics include Accuracy (Acc), Sensitivity (SEN), Positive Predictivity (PPV),
Specificity (SPE), and F1-score.
• F1-score is used for classification evaluation
• Other metrics defined include PPV, SEN, SPE, and Acc,
Preprocessing and Implementation Details:
• ECG recordings in the dataset have varying lengths, requiring preprocessing to standardize
length for DNN training.
• Preprocessing involves converting recordings to the same length by padding or truncating
for consistency in training.

Dept. of CSE, SJBIT 2023-2024 Page 19


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Figure 4.2 Plot of the proposed ResNet-LSTM with GA when using k-NN as a classifier (the best classifier)
and Plot of the proposed ResNet-LSTM with GA when using k-NN as a classifier (the best classifier)

Figure 4.2 as it presents with GA and 4b as it presents without GA presents the graphs showing the
validation of the proposed k-NN ML model with and without using GA-based optimization.
A reading of the two plots confirms the choice of the GA-optimized strategy as more efficient.
From the results that the comparison presented it can be concluded that the proposed method
matches or betters the other methods in terms of robustness for the data set reported. As noted
earlier, as a motivation for embarking on this study, while it was observed that there are a good
number of machine or deep learning approaches for detecting heart disorders (such as arrhythmia),
most of them are encumbered by the computational overhead associated with the complex
frameworks utilized in their detection models .

4.2 Results of Detection in ECG Images


For performance analysis, accuracy, precision, recall, F1 score, and training and testing times were
used. These measurements are based on the analysis of the data in a confusion matrix. Table V
shows how the measurements are defined based on the confusion matrix. Where the accuracy is
the percentage of positively predicted observations relative to the total number of observations.
Recall represents the ratio of positively predicted observations to all observations in the true class
(should be positively estimated).
Dept. of CSE, SJBIT 2023-2024 Page 20
Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Precision expresses the ratio of positively predicted to all observations in the predicted class
(should be positively predicted). The F1 score is the weighted average of both Recall and
Precision. Thus, it takes into account both the false negatives and the false positives values

Figure 4.3 Table comparing different models for their performance

Figure 4.3 shows the performance measures of the pretrained models (SqueezeNet and AlexNet)
used as the transfer learning approach and our proposed CNN model for the ECG images dataset.
Each model was trained with different values for learn ing rate LR (0.01, 0.001, and 0.0001).
As noticed, the most successful result with an average accuracy rate of 98.23% was obtained by
our proposed CNN model when the RL was 0.0001.

The power of deep learning can be used to extract image features without re-training the entire
network. The activations of the network are computed by forward propagation of the input
images up to the specific feature layer

The performance measures are calculated and presented in Figure 4.3. As can be seen, the most
successful result was obtained with a rate of 99.79% for the accuracy, recall, precision, and F1-
score of the NB algorithm when our proposed CNN model was used as the feature extractor. The
accuracy rates of 99.47%, 97.87%, and 97.66% were obtained by the SVM algorithm when our
proposed CNN model, SqueezeNet, and AlextNet, respectively, were used to extract the features.
As a result, the best achievements for all performance measures were obtained when using our
proposed CNN model as the feature extractor

Dept. of CSE, SJBIT 2023-2024 Page 21


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Figure 4.4 Calculated Performance Measurements for ML Algorithms that use different Feature Extractors

Although the extracted feature size of our proposed CNN model is the smallest, it achieved the
best results on all performance measures, as shown in figure 4.4. Therefore, this is an indication
that our proposed model is built to learn the key features of the ECG images dataset. Thus, the
advantages of the proposed model are not only the better accuracy rates but also the lower
computational costs compared to the works in the literature.
Relief showcased promising results in feature selection for CVD prediction, performing notably
well alongside FCBF. By evaluating feature relevance based on instance-level comparisons,
Relief enhanced the diagnostic accuracy of predictive models and complemented the
contributions of FCBF.

This synergistic approach resulted in a refined feature subset, significantly enhancing diagnostic
accuracy beyond what each technique achieved individually.

The performance measures are calculated and presented in Figure 4.3. As can be seen, the most
successful result was obtained with a rate of 99.79% for the accuracy, recall, precision, and F1-
score of the NB algorithm when our proposed CNN model was used as the feature extractor.
Theaccuracy rates of 99.47%, 97.87%, and 97.66% were obtained by the SVM algorithm when
our proposed CNN model, SqueezeNet, and AlextNet, respectively, were used to extract the
features. As a result, the best achievements for all performance measures were obtained when

using our proposed CNN model as the feature extractor.

Dept. of CSE, SJBIT 2023-2024 Page 22


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Although the extracted feature size of our proposed CNN model is the smallest, it achieved the
best results on all performance measures, as shown in figure 4.3. Therefore, this is an indication
that our proposed model is built to learn the key features of the ECG images dataset. Thus, the
advantages of the proposed model are not only the better accuracy rates but also the lower
computational costs compared to the works in the literature.

This highlights the superior performance of a proposed convolutional neural network (CNN)
model for analyzing electrocardiogram (ECG) images. Despite having the smallest extracted
feature size, the model achieved the best results across all performance measures. When
coupled with traditional machine learning algorithms such as Naive Bayes and k-Nearest
Neighbors (kNN), the CNN-based approach yielded impressive accuracies of up to 98-99
percent.

Each model was trained with different values for learning rate LR (0.01, 0.001, and 0.0001). As
noticed, the most successful result with an average accuracy rate of 98.23% was obtained by our
proposed CNN model when the RL was 0.0001.

The power of deep learning can be used to extract image features without re-training the entire
network. The activations of the network are computed by forward propagation of the input
images up to the specific feature layer.The performance measures are calculated and presented
in Figure 4.3. As can be seen, the most successful result was obtained with a rate of 99.79% for
the accuracy, recall, precision, and F1- score of the NB algorithm when our proposed CNN
model was used as the feature extractor.

Dept. of CSE, SJBIT 2023-2024 Page 23


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

Chapter 5

CONCLUSION

The study's exploration of machine learning (ML) and artificial intelligence (AI) techniques in
cardiovascular disease (CVD) prediction and management represents a significant step towards
transforming cardiovascular healthcare. Through the evaluation of feature selection techniques
and the development of a convolutional neural network (CNN) model for ECG image
classification, the study has demonstrated the potential of ML and AI to enhance diagnostic
accuracy and improve patient outcomes in the context of CVD.

 Impact on Diagnostic Practices: The findings underscore the transformative potential of


ML and AI techniques in revolutionizing diagnostic practices in cardiovascular healthcare.
 Enhanced Predictive Models: The evaluation of feature selection techniques, including
MRMR, FCBF, and Relief, has yielded valuable insights into identifying informative features for
CVD prediction, thereby contributing to the development of more accurate and robust predictive
models.
 Early Detection Enabled: The CNN model's accurate classification of ECG images
enables early detection of cardiovascular diseases, facilitating timely intervention and improving
patient prognosis.
 Clinical Significance: The study's findings hold immense clinical significance, as they
have the potential to significantly impact patient outcomes and reduce morbidity and mortality
rates associated with CVD.
 Future Research Directions: The study highlights the importance of further refinement
and exploration of ML and AI-driven methodologies in cardiovascular disease prediction and
management. Future research should focus on refining existing techniques, exploring novel
approaches, and translating ML and AI-driven interventions into clinical practice.
 Interdisciplinary Collaboration: Collaborative efforts between data scientists, clinicians,
researchers, and policymakers are essential to drive innovation and advancement in ML and AI-
driven cardiovascular disease prediction.

Dept. of CSE, SJBIT 2023-2024 Page 24


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

 Ethical Considerations: Ethical considerations surrounding data privacy, patient consent,


and algorithmic transparency must be carefully addressed to ensure the responsible and ethical
deployment of ML and AI technologies in cardiovascular healthcare.

The study proposes a novel framework for detecting and classifying cardiovascular disease
(CVD) using machine learning algorithms and optimal feature selection techniques. It
emphasizes the significant impact of feature selection on enhancing the performance of machine
learning algorithms in CVD prediction. Evaluating five different feature selection techniques,
including MRMR, FCBF, LASSO, Relief, and ANOVA, the study finds that FCBF exhibits
superior performance. When combined with Extra Tree and Random Forest models, FCBF
achieves an impressive accuracy of 78%, highlighting its effectiveness in selecting relevant
features from large-scale CVD datasets. Moreover, the study underscores the importance of
selecting appropriate feature selection and optimization techniques based on dataset
characteristics, especially for datasets with predominantly categorical features.

In addition to the feature selection framework, the research article proposes a lightweight CNN-
based model for classifying major cardiac abnormalities using a public ECG images dataset. The
proposed CNN model demonstrates remarkable results in CVD classification and can serve as a
feature extraction tool for traditional machine learning classifiers. This CNN model offers
potential as an assistance tool for clinicians in detecting cardiac diseases from ECG images,
bypassing the manual process that can lead to inaccurate and time-consuming results. Future
work could focus on optimizing hyperparameters of the CNN model and exploring its
application in predicting other types of problems, especially in domains like the Industrial
Internet of Things, where low-scale deep learning methods may find practical utility.

5.1 Areas for Further Refinement and Future Research:

- Refinement of Techniques: There is a need for further refinement and optimization of


feature selection techniques to improve their effectiveness in identifying informative features for
CVD prediction.

Dept. of CSE, SJBIT 2023-2024 Page 25


Multitier Machine Learning Approaches for Enhanced Arrhythmia Detection and
Cardiovascular Disease Diagnosis in ECG Images

- Exploration of Novel Approaches: Future research should explore novel ensemble


methods and deep learning architectures tailored specifically for cardiovascular disease
prediction, aiming to further enhance diagnostic precision and confidence.

- Clinical Translation: Efforts should be directed towards translating ML and AI-driven


approaches into clinical practice, ensuring their seamless integration into existing healthcare
workflows and protocols.

- Longitudinal Studies: Longitudinal studies are warranted to evaluate the long-term


impact and effectiveness of ML and AI-driven interventions in improving patient outcomes and
reducing CVD-related morbidity and mortality rates.

5.2 Discussion on Future Research Directions:

 Interdisciplinary Collaboration: Collaborative efforts between data scientists, clinicians,


researchers, and policymakers are essential to drive innovation and advancement in ML and AI-
driven cardiovascular disease prediction.
 Data Sharing Initiatives: Initiatives aimed at promoting data sharing and collaboration
across institutions and research consortia are crucial for facilitating large-scale studies and
enhancing the generalizability of ML and AI-driven predictive models.
 Ethical Considerations: Ethical considerations surrounding data privacy, patient consent,
and algorithmic transparency must be carefully addressed to ensure the responsible and ethical
deployment of ML and AI technologies in cardiovascular healthcare.

Dept. of CSE, SJBIT 2023-2024 Page 26


REFERENCES
1. M. H. Khosravi, A. Nahavandi, and D. Creighton, "Heart Disease Diagnosis Using Deep
Learning Methods," in *IEEE Access*, vol. 5, pp. 11840-11850, 2017. doi:
10.1109/ACCESS.2017.2711649

2. A. S. H. Bhuiyan, M. A. Mottalib, and A. N. Mahmud, "Automated Cardiovascular Diseases


Prediction Using Deep Learning," in *2017 IEEE International Conference on Imaging, Vision
& Pattern Recognition (icIVPR)*, 2017, pp. 1-6. doi: 10.1109/ICIVPR.2017.7890040

3. D. A. Adarsha, S. Priya, and G. Deepika, "Automatic Detection and Classification of Heart


Disease Using ECG Signals," in *2018 International Conference on Current Trends towards
Converging Technologies (ICCTCT)*, 2018, pp. 1-6. doi: 10.1109/ICCTCT.2018.8550894

4. N. Maheshwari, S. Kumar, and M. Maheshwari, "Cardiovascular Diseases Detection Using


Machine Learning Techniques: A Review," in *2019 5th International Conference on
Advanced Computing & Communication Systems (ICACCS)*, 2019, pp. 1-6. doi:
10.1109/ICACCS.2019.8724966

5. S. K. Sathya and S. M. Anand, "ECG Based Cardiovascular Disease Identification Using


Machine Learning Algorithms," in *2019 3rd International Conference on Intelligent Computing
and Control Systems (ICICCS)*, 2019, pp. 840-844. doi: 10.1109/ICICCS.2019.8722755
IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL 373
2023

Detection of Cardiovascular Diseases in ECG


Images Using Machine Learning and Deep Learning
Methods
Mohammed B. Abubaker and Bilal Babayig˘it

Abstract—Cardiovascular diseases (heart diseases) are the Digital Object Identifier 10.1109/TAI.2022.3159505
lead- ing cause of death worldwide. The earlier they can be
predicted and classified; the more lives can be saved.
Electrocardiogram (ECG) is a common, inexpensive, and
noninvasive tool for measuring the electrical activity of the heart
and is used to detect cardiovascular disease. In this article, the
power of deep learning techniques was used to predict the four
major cardiac abnormalities: abnormal heartbeat, myocardial
infarction, history of myocardial infarction, and normal person
classes using the public ECG images dataset of cardiac patients.
First, the transfer learning approach was in- vestigated using the
low-scale pretrained deep neural networks SqueezeNet and
AlexNet. Second, a new convolutional neural net- work (CNN)
architecture was proposed for cardiac abnormality prediction.
Third, the aforementioned pretrained models and our proposed
CNN model were used as feature extraction tools for traditional
machine learning algorithms, namely support vector machine, K-
nearest neighbors, decision tree, random forest, and Naïve Bayes.
According to the experimental results, the perfor- mance metrics
of the proposed CNN model outperform the exiting works; it
achieves 98.23% accuracy, 98.22% recall, 98.31% pre- cision,
and 98.21% F1 score. Moreover, when the proposed CNN model
is used for feature extraction, it achieves the best score of 99.79%
using the NB algorithm.
Impact Statement—Artificial intelligence plays an important role
in improving the quality of life. In particular, early detection
of diseases can help save lives. In this work, the proposed new
lightweight CNN architecture has improved the accuracy rate
of cardiovascular disease classification to 98.23% compared with
the existing state-of-the-art methods, using the dataset of ECG
images of cardiac patients, and can be performed on a single
CPU, overcoming the limitation of computational power. In
addition, the classification accuracy has significantly improved
after applying the proposed method as a feature extraction tool
for traditional machine learning algorithms. For example, an
accuracy of 99.79% has been achieved using the Naïve Bayes
algorithm. Thus, this method could be integrated into the IoT
ecosystem in healthcare. This will encourage other AI
researchers to explore other methods for cardiovascular disease
detection.
Index Terms—Cardiovascular, deep learning, electrocar
diogram (ECG) images, feature extraction, machine learning,
transfer learning.

Manuscript received 2 March 2022; accepted 11 March 2022. Date of pub-


lication 15 March 2022; date of current version 24 March 2023. This article
was recommended for publication by Associate Editor Mihail Popescu upon
evaluation of the reviewers’ comments. (Corresponding author: Mohammed
B. Abubaker)
Mohammed B. Abubaker is with the Department of Computer Engineering,
Erciyes University, 38039 Melikgazi, Turkey, and also with the Palestine
Tech- nical College, Gaza P920, Palestine (e-mail:
mabubaker@ptcdb.edu.ps).
Bilal Babayig˘it is with the Department of Computer Engineering,
Erciyes University, 38039 Melikgazi, Turkey (e-mail: bilalb@erciyes.edu.tr).
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL 373
2023

I. INTRODUCTION [10]. The machine learning methods require an expert entity for
features extraction and selection to identify the appropriate
CCORDING to the World Health Organization,
cardio- vascular diseases (heart diseases) are the leading
cause of death worldwide. They claim an estimated 17.9
A
features before apply- ing the classification phase. Feature
extraction is a process of reducing the number of features in a
data set by transforming or projecting the data into a new
million lives each year, accounting for 32% of all deaths
lower-dimensional feature space preserving the relevant
worldwide. About 85% of all deaths from heart disease are
information of the input data [11], [12].
due to heart attacks, also known as myocardial infarctions
The concept of feature extraction is concerned with creating
(MI) [1]. Many lives can be saved if an efficient diagnosis
a new set of features (different from the input feature) that are
of cardiovascular disease is detected at an earlier stage [1].
a combination of original features into a lower-dimensional
Different techniques are used in the healthcare system to
space that extract most, if not all, of the information in input
detect heart diseases, such as electro- cardiogram (ECG),
data. The most well-known feature extraction method is a
echocardiography (echo), cardiac magnetic resonance
principal component analysis [13], [14]. However, feature
imaging, computed tomography, blood tests, etc. [2], [3].
selection is a process of removing irrelevant and redundant
The ECG is a common, inexpensive, and noninvasive tool
features (di- mensions) from the data set in the training
for measuring the electrical activity of the heart [4]. It is
process of machine learning algorithms. Various methods can
used to identify heart-related cardiovascular diseases [4],
be used for feature selection, classified as unsupervised, which
[5]. A highly skilled clinician can detect heart disease from
refers to the method that does not need the output label for
the ECG waves.
feature selection, and supervised, which refers to the methods
However, this manual process can lead to inaccurate results
that use output label for feature selection. Under supervised
and is very time-consuming [5].
feature selection, there are three methods: the filter method,
There is great potential to benefit from advances in
the wrapper method, and the embedded method [11], [12].
artificial intelligence in healthcare to reduce medical errors.
Many machine learning methods have been used for
In particular, the use of machine learning and deep learning
predict- ing cardiovascular diseases. Soni et al. [15]
techniques for automatic prediction of heart diseases [3], [6]–
compared several
2691-4581 © 2022 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission.
See https://www.ieee.org/publications/rights/index.html for more information.

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
374 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

disease classification. In addition, a new CNN model is proposed


for heart disease prediction using ECG images and used for
feature extraction of the ECG images after training the new
proposed CNN model.
The main contributions of this study are summarized as fol-
lows.
1) A new lightweight deep learning CNN architecture is
Fig. 1. Abstract concept of machine learning and deep learning. proposed for cardiovascular diseases prediction using 12
lead-based ECG images.
2) The proposed CNN model achieves a success rate of
machine learning algorithms, such as decision tree (DT), 98.23%, outperforming the existing work [22] and the
Naïve Bayes (NB), K-nearest neighbors (K-NN), and neural state-of-the-art low-scale SqueezeNet and AlexNet, which
network (NN) on UCI Cleveland heart disease dataset. They achieved 95.10%, 95.47%, and 96.79%, respectively.
concluded that DT had the highest accuracy of 89%. 3) To the best of our knowledge, this is the second study
Dissanayake and Md Johar [16] studied the effect of the using the ECG images dataset of cardiac patients [23],
feature selection process on machine learning classifiers for which will encourage other researchers to explore other
predicting heart diseases from the UCI Cleveland heart methods to detect cardiovascular diseases using this
disease dataset. They examined differ- ent feature selection dataset.
techniques, such as ANOVA, Chi-square, forward and 4) The transfer learning approach using SqueezeNet and
backward feature selection, and Lasso regression. After that, Alex-Net was investigated and compared with the pro-
they applied six machine learning classifiers, which are DT, posed model.
random forest (RF), support vector machine (SVM), K-NN, 5) The pretrained networks SqueezeNet, AlexNet and our
logistic regression (LR), and Gaussian NB (GNB). With the proposed CNN model were used as feature extractors to
feature selection process, the prediction accuracy was im- apply the extracted features to the conventional machine
proved such that using the backward feature selection method, learning methods: SVM, K-NN, DT, RF, and NB. The best
the highest classification accuracy of 88.52% has been results were achieved by our proposed CNN model for the
achieved with the DT classifier. The use of machine learning NB algorithm in which the accuracy rate was reported as
algorithms, such as NB, SVM, and DT algorithms, was 99.79%.
studied in [17] using ten-fold cross-validation, on the South The rest of this article is organized as follows. Section II
African heart dis- ease dataset with 462 instances. The best presents the literature review. The methods and the proposed
results were obtained from NB for detecting heart disease with CNN model used in this article are explained in Section III.
an accuracy rate of 71.6%, sensitivity of 63%, and specificity Section IV illustrates the dataset and experimental settings
of 76.16%. Kim et al. [18] compared NN, SVM, classification used. Section V provides the results and discussions, whereas
based on multiple association rule (CMAR), DT, and NB Sec- tion VI concludes this article and provides future
algorithms to predict cardiovascular diseases on two types of perspectives.
datasets consisting of ultrasound images of carotid arteries
(CAs) and heart rate variability (HRV) of the ECG signal.
II. LITERATURE REVIEW
The combined extracted
features from the CAs+ HRV dataset obtained higher accuracy Many research works [24]–[27] have been conducted for
than the separated features of CAs and HRV. Thus, SVM and automatically predicting cardiovascular diseases using
CMAR classifiers outperformed the others by the accuracy of machine learning and deep learning methods by utilizing ECG
89.51% and 89.46%, respectively. as digitals or images data representation.
On the other hand, deep learning, which is a subfield of Bharti et al. [28] compared machine learning and deep
machine learning, automatically extracts important features learn- ing methods on the UCI heart disease dataset to predict
and patterns from the training datasets for the classification two classes. The deep learning method achieved the highest
phase without the intervention of separate entities for features accuracy rate of 94.2%. In their architecture of deep learning
ex- traction and selection. Fig. 1 illustrates the abstract model, they used three fully connected layers: the first layer
concept of machine learning and deep learning. In deep consists of 128 neurons followed by a dropout layer with 0.2
learning, a model is created by constructing multiple hidden rate, the second layer consists of 64 neurons followed by a
layers of NNs. Convolutional neural network (CNN) is a deep dropout layer with
learning method, which has achieved satisfactory results on 0.1 rate, and the third layer consists of 32 neurons. The
image classification tasks. machine learning methods with features selection and outliers’
The power of deep learning and pretrained networks can detection achieved accuracy rates as: RF is 80.3%, LR is
be used for feature extraction without having to retrain the 83.31%, K-NN is 84.86%, SVM is 83.29%, DT is 82.33%,
whole network, transfer learning, and classification [19]. In and XGBoost is 71.4%. The research in [29] concluded that
this article, the pretrained networks, i.e., SqueezeNet [20] and deep learning has proven to be a more accurate and effective
AlexNet [21], are used as a transfer learning approach to study technology for a variety of medical problems such as
their performance in heart disease classification and as feature prediction. Deep learning methods will replace the
extraction for traditional machine learning methods for heart traditional machine learning based on feature engineering.
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
374 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

Kiranyaz et al. [30] proposed a CNN that consisted of three


layers of an adaptive implementation of

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
ABUBAKER AND BABAYIG˘ IT: DETECTION OF CARDIOVASCULAR DISEASES IN ECG IMAGES USING MACHINE 375
LEARNING

one-dimensional (1-D) convolution layers. This network was


trained on the MIT-BIH arrhythmia dataset to classify long ECG
data stream. They achieved accuracy rates of 99% and 97.6%
in classifying ventricular ectopic beats and supraventricular
ec- topic beats, respectively. Also, the work in [31] proposed a
CNN that consisted of three 1-D convolution layers, three max-
pooling layers, one fully connected layer, and one softmax
layer. The filter size for the first and second convolutional
layers was set to 5 and a stride of 2 was used for the first two Fig. 2. Example of a convolution operation.
max-pooling layers. They achieved an accuracy rate of 92.7%
in classifying ECG heartbeats using the MIT-BIH arrhythmia
dataset.
Khan et al. [22] applied transfer learning approach using connected layers for classification, but instead used an
the pretrained single shot detector (SSD)-MobileNet-v2 [32] average pooling layer followed by a softmax layer. This model
to detect cardiovascular diseases from the ECG images dataset achieved an accuracy rate of 98.33%.
of cardiac patients by predicting the four major heart Acharya et al. [38] implemented a deep CNN with four 1-
abnormalities: abnormal heartbeat (AH), MI, history of MI (H. D convolutional layers and three fully connected layers for
MI), and normal person (NP) classes. As preprocessing steps, detecting MI using ECG signals in the PTB dataset. In this
the data size was adjusted and the 12 leads of each ECG image model, the leaky rectifier linear unit (LeakyRelu) was used as the
were labeled. SSD is used to classify and localize the objects in activation function layer. Each convolutional layer was
one step. The dataset was split 80% for training and 20% for followed by a max-pooling layer with a filter size of 2 and a
testing. They used a batch size of 24, 200K training iterations stride of 2. The filter sizes for convolutional layers were 102,
for the training step, and a learning rate of 0.0002 to train their 24, 11, and 9 in order. The numbers of neurons for fully
model. Their training phase lasted almost 4 days. They connected layers were 30, 10, and 2 in that order. The last fully
achieved a high precision rate for the MI class, i.e., 98.3%. connected layer was followed by a softmax layer. They
Rahman et al. [33] provided a deep CNN transfer learn- achieved an average accuracy rate of 93.53% and 95.22% for
ing approach to predict COVID-19 and four major car- ECG beats with and without noise removal, respectively.
diac abnormalities using ECG images. The dataset contained Naz et al. [39] converted ECG signals into 32 × 32 binary
five classes: COVID-19, AH, MI, H. MI, and NP classes. images. Their model was tested with the MIT-BIH dataset using
Six different pretrained deep CNN models, i.e., ResNet18, the pretrained CNN models AlexNet, VGG19, and Inception-V3
ResNet50, ResNet101, DenseNet201 [34], Inception-V3 [35], to detect ventricular arrhythmias of the heart. Transfer learn-
and MobileNet-v2, were used for classification. Gamma cor- ing was performed to extract and concatenate features from
rection, image resizing, and z-score normalization were used the pretrained models. SVM and K-NN classification methods
as preprocessing steps for the ECG images. As a result, for were then used for binary classification. Using the SVM, they
two-class classification (COVID-19 and normal) and three-class achieved an accuracy of 97.60%.
classification (COVID-19, normal, and other cardiac abnormali-
ties), DenseNet201 outperformed the other networks with
accu- racy rates of 99.1% and 97.36%, respectively. For the III. METHODS
five-class classification, Inception-V3 outperformed the other A. Convolutional Neural Networks (CNN)
networks with an accuracy rate of 97.83%.
In deep learning, a CNN is a type of deep artificial NN
Pal et al. [36] presented a deep CNN transfer learning strategy
specifically designed for image classification and processing
using pretrained DenseNet arrhythmia classifications (AH) from
[40]. The neurons in CNNs are arranged in three dimensions:
ECG signals in PTB and MIT-BIH arrhythmia datasets con-
height, width, and depth (channel). For example, an input image
verted to 2-D images. Since the dataset was imbalanced, a
is 227 ×227 3, which means that the width and height of the
data augmentation technique was applied to the data. The
input image are 227 and the depth (channel) is 3. The main
DenseNet model was chosen because it provides a solution to
task of CNNs is to extract important features from the input
the vanishing gradient problem in deep networks by using
images. The two main components of CNNs are convolutional
dense connections between layers. Their model was referred
layers and pooling layers. The higher layers in CNNs can be fully
to as CardioNet. The precision, recall, and F1 score values were
connected layers and the last layer is a sigmoid or softmax
98.62%, 98.68%, and 98.65%, respectively.
activation func- tion layer to get the predicted output. The
Avanzato and Beritelli [37] proposed a deep CNN with four
convolution process is performed with convolutional layers on
1-D convolutional layers for detecting three classes of cardiac
the input data using a filter or kernel to create a feature map
abnormalities using ECG signals in the MIT-BIH arrhythmia
representing the detected features of the input. Convolution is
dataset. Each convolutional layer was followed by a batch
performed by sliding the filter over the input. At each
nor- malization layer, a rectifier linear unit (ReLU) layer
position, matrix multiplication is performed and the result is
activation function, and a max-pooling layer with a filter
summed onto the feature map. Fig. 2 shows a simple example
(kernel) size of 4. A size 80 filter was used for the first
of a convolution process for an input with a depth of 1.
convolutional layer, and the others had a filter size of 4. This
architecture did not use fully
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
376 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

Fig. 3. Example of 2 × 2 max-pooling with stride = 2. normalization layer, and

The convolution process is linear. To add nonlinearity to


the output, the convolution layer is followed by an activation
function layer such as ReLU or its variants. After the convolution
layer, a pooling layer such as max-pooling layer could be used to
downsample the feature map to reduce the computational cost.
Fig. 3 shows a simple example of max-pooling for an input
with depth of 1.

B. Pretrained Deep Learning Models


The pretrained deep NNs can be used for transfer learning,
feature extraction, and classification. In this article, low-scaled
SqueezeNet and AlexNet pretrained CNN networks that can
be executed on a single CPU are used for transfer learning and
feature extraction.
The transfer learning approach is commonly used with pre-
trained deep NNs applied to a new dataset. Therefore, it could
benefit from the pretrained network that has already learned a
variety of features that can be transferred to other similar
tasks. Most of the pretrained networks have been trained with
more than a million images and can classify images into 1000
object classes. In applying the transfer learning approach, the
final layers of the pretrained network are replaced with new
layers to learn the specific features of the new dataset. Then,
the model is fine-tuned by training it on a new training dataset
with specific training parameters and testing its performance
measure on a new test dataset.
The pretrained deep NNs can be used as a feature extraction
tool without wasting time and effort on training. In this article,
the extracted features from the pretrained networks are used to
train traditional machine learning classifiers, namely SVM [41],
K-NN [42], DT [43], RF [44], and NB [45]. The details of
using the pretrained networks are explained in the next
Sections.

C. Proposed CNN Architecture


The proposed CNN model contains besides the input and
output layers, six 2-D convolutional layers, three fully connected
layers, three max-pooling layers, eight leaky ReLU layers, eight
batch normalization layers, five dropout layers, two depth
con- catenation layers, and one softmax layer. In total, there
are 38 layers. The architecture of the proposed model is shown in
Fig. 4. The proposed CNN model consists of two branches that
help extract more representative features, namely the stack
branch and the full branch. The proposed CNN model
accepts input× image of size 227 227 3. The input image
flows into the two
branches simultaneously.
The stack branch consists of three stacked× 2-D 3 3
convolu- tional layers. Each of these 2-D convolutional layers
is followed by the leakyReLU layer, the batch
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
376 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

Fig. 4. Representation architecture of the proposed CNN model.

the max-pooling layer. In the leakyReLU layer, a leakyReLU


activation function with a scale of 0.1 is used. Unlike ReLU,
leakyReLU has a slight slope in the negative range, which
can eliminate the problem of dying neurons [46]. The batch
normal- ization layer is used to normalize its inputs for each
minibatch, which can train the model faster and increase
the accuracy of the model. The max-pooling layer applies
the max-pooling operation to the feature map by selecting the
maximum element from the region covered by the filter. This
helps to reduce the spatial size of the feature map to reduce the
number of parameters and computational cost in the model.
The proposed CNN model uses max-pooling layers of 6 6 ×
filter size with a stride of 3. In this branch, 64, 128, and 224
filters are used to extract deep

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
ABUBAKER AND BABAYIG˘ IT: DETECTION OF CARDIOVASCULAR DISEASES IN ECG IMAGES USING MACHINE 377
LEARNING

TABLE I
LAYERS ANALYSIS OF THE PROPOSED CNN MODEL

leakyReLU: scale=0.1, batch normalization: MeanDecay=0.1, VarianceDecay=0.1, Epsilon=0.00001, total number of learnable parameters=3430308

features of the data for the first, second and third


convolutional layers, respectively. The size of the output at the
end of the stack
× × branch is 2 2 224.
The first layer in the full branch of our proposed CNN
model is a fully connected layer, hence its name. In our
model, the fully connected layer contains 16 neurons. Each
neuron in a fully connected layer is connected to each neuron in
the previous layer. This is in contrast to a neuron in a
convolutional layer, which is connected to some neurons in
the previous layer defined by the size of the convolutional
filter. Although most of the parameters in the CNN come from
the fully connected layers, the number of calculations in the
convolutional layer requires much more memory. The fully
connected layer is followed by a leakyReLU layer, a batch
normalization layer, and a dropout layer, which helps to
Fig. 5. Schematic of using the proposed CNN model for ECG images of
reduce overfitting and emphasize the generalization capability cardiac patients’ classification.
of the model. As can be seen in Fig. 4, the two convolutional
layers, named conv04 and conv05, are located at the same
level after the block of the fully connected layer to help nonlinearity of the model and reduce the depth or number of
extract broader features. feature maps to reduce computational cost. A fully connected
Conv04 is a 32 2 × 2 convolutional layer with a stride of 1 and layer with 512 neurons is added to strengthen the
a padding of 1, whereas conv05 is a × 64 3 3 convolutional classification process. For the output, a fully connected layer
layer with a stride of 2 and a padding of 2. The feature maps with four neurons corresponding to the number of classes to be
of these two convolutional layers are concatenated to produce classified, followed by a softmax layer to obtain the predicted
a feature × map×of 2 2 96. After concatenating the features, a output. The analysis of the trained network for the proposed
dropout layer is applied to reduce the impact of correlated CNN model is given in Table I.
features and avoid overfitting. The schematic of using the proposed CNN model for the
The two outputs generated by the two branches are concate- classification of ECG images of cardiac patients is shown in
nated to create a feature map of 2×2×320. Then, a dropout Fig. 5. First, the input images are preprocessed by cropping,
layer is added to reduce the overfitting of the model. A 1×1 resizing, and augmenting them. Then, the preprocessed
convolutional layer with 256 filters is added to increase the images are stored in the image datastore. The proposed model
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
ABUBAKER AND BABAYIG˘ IT: DETECTION OF CARDIOVASCULAR DISEASES IN ECG IMAGES USING MACHINE 377
LEARNING
is trained

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
378 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

TABLE II
PUBLIC ECG IMAGES DATASET DESCRIPTION

Fig. 7. Sample from the ECG images dataset after performing cropping as a
preprocessing.

TABLE III
TRAINING PARAMETERS AND VALUES FOR DEEP LEARNING METHODS

a 4 GB NVIDIA GeForce 820M GPU1 and running Windows


10 Pro 64-b.
Preprocessing. As can be seen in Fig. 6, the ECG images in
the dataset contain header and footer information that have no
relation to the features we need. Therefore, we have applied
cropping for all images to focus on the valuable features as
Fig. 6. Samples from the ECG images dataset. (a) NP. (b) AH. (c) MI. (d) H.
MI.
shown in Fig. 7. In addition, all ECG images were resized to
the same resolution of 227×227 with 3 channels (RGB) before
performing model training.
Data augmentation. To increase the robustness and
with the above-mentioned training parameters using the ECG
accuracy of the developed model, data augmentation was
images stored in the image datastore. The model learns the
applied to the dataset [47]. It helps to increase the number of
features and adjusts its learnable parameters accordingly.
images in the dataset and eliminate the effects of training the
After training, the model is ready to test ECG images for
model on an imbalanced dataset. Three augmentation
classifying cardiac abnormalities as one of the four classes:
techniques (rotation, flipping, and translation) were applied to
NP, AH, MI, and H. MI.
the given dataset [48]. This increased the number of images in
the dataset to 4700 images.
IV. EXPERIMENTS Deep learning training parameters. Since the optimization
of hyperparameters is very computationally intensive, all
A. ECG Images Dataset of Cardiac Patients
experi- ments were performed using the training parameters
The mentioned methods were tested on the ECG Images listed in Table III. Adam optimizer is applied to train the
dataset of cardiac patients [23]. This dataset contains 928 model for 16 epochs with a minibatch size of 128. However,
differ- ent patient records with 4 different classes as shown in since the initial learning rate value (LR) is the most important
Table II. These four classes are NP, AH, MI, and H. MI. Fig. hyperparameter, different values for LR were used in the
6 depicts some samples from the dataset. An NP is a healthy experiments, which are mentioned in the next section.
person who does not have any heart abnormalities. An AH According to these parameters, the number of iterations per
(arrhythmia) occurs when the electrical impulses in the heart epoch is 29 and the number of iterations for training the model
become too fast, too slow, or irregular so that the heart beats is 464.
irregularly. MI, also known as heart attack, occurs when blood To obtain reliable results when testing and evaluating the
flow in the coronary artery of the heart decreases or stops, model, fivefold cross-validation was performed. In this
causing damage to the heart muscle. The patients with an H. process, the dataset is divided into five parts, with four parts
MI have recently recovered from MI or heart attack. used for the training phase and the remaining part used for the
testing phase (3760 images for training and 940 images for
B. Experimental Settings testing). Thus, five different distinctions between training and
testing were applied. The results are the average of the five
The experiments were conducted with MATLAB 2021b on folds.
Intel coreTM i7-4510U CPU @ 2.00 GHz with 8GB RAM and
1
Its compute capability is 2.1 and it is not supported by MATLAB 2021b.
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
378 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023
Hence, all experiments were run on a single CPU.

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
ABUBAKER AND BABAYIG˘ IT: DETECTION OF CARDIOVASCULAR DISEASES IN ECG IMAGES USING MACHINE 379
LEARNING

TABLE IV
TABLE VI
PERFORMANCE MEASURES
CALCULATED PERFORMANCE MEASUREMENTS FOR SQUEEZE-NET, ALEXNET,
AND THE PROPOSED CNN MODEL FOR DIFFERENT RL VALUES

TABLE V
NETWORKS PROPERTIES2

LR: initial learning rate, A.: accuracy, R.: recall, P.: precision, F1: F1 score, T1: training
time, T2: testing time.
The bold values indicate the best results.
For all networks, input image size is 227×227×3.
TABLE VII
PERFORMANCE MEASUREMENTS VALUES OBTAINED FOR EACH FOLD OF THE
PROPOSED MODEL

Fig. 8. Semantic of the confusion matrices for four classes results.

V. RESULTS AND DISCUSSIONS


For performance analysis, accuracy, precision, recall, F1
score, and training and testing times were used. These mea-
surements are based on the analysis of the data in a confusion
matrix. Table V shows how the measurements are defined based
on the confusion matrix. Where the accuracy is the percentage of
positively predicted observations relative to the total number
of observations. Recall represents the ratio of positively
predicted observations to all observations in the true class
(should be positively estimated). Precision expresses the ratio
of positively predicted observations to all observations in the
predicted class (should be positively predicted). The F1 score
The bold values indicate the average of the five folds.
is the weighted average of both Recall and Precision. Thus, it
takes into account both the false negatives and the false
positives values.
Fig. 8 shows the semantics of the confusion matrix for 4 number of neurons as the number of our predicted classes, i.e., 4.
classes datasets as in our case, the ECG images dataset of cardiac However, since SqueezeNet does not use fully connected layers,
patients. The performance measurements of the experiments are we replace the last convolutional layer which is used to
calculated based on the equations given in Table IV. identify 1000 classes with a new convolutional layer ×
containing 4 1 1 filters. For both pretrained networks used, a
A. Results of Transfer Learning and Proposed CNN Model new classification layer is added in place of the existing one,
which produces an output based on the probabilities computed
The state-of-the-art architectures of the pretrained networks by the softmax layer. The properties of the pretrained networks
SqueezeNet and AlexNet were used to apply the transfer learning used and our proposed CNN are shown in Table V.
approach in our study. Both were originally trained for the Table VI shows the performance measures of the pretrained
classification of 1000 image classes. To retrain these networks models (SqueezeNet and AlexNet) used as the transfer
for classifying the new set of ECG images in the dataset, we learning approach and our proposed CNN model for the ECG
replace the last layers of these models to make them suitable images dataset. Each model was trained with different values
for the new task. In AlextNet, the last fully connected layer is for learn- ing rate LR (0.01, 0.001, and 0.0001). As noticed,
replaced with a new fully connected layer containing the same the most successful result with an average accuracy rate of
98.23% was obtained by our proposed CNN model when the RL
2
Here, the total number of layers in the network was counted, not even the was 0.0001. Table VII shows the detailed analysis of the
convolutional layers and dense layers. proposed model. The

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
380 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

Fig. 9. Training Progress for our proposed CNN model on the ECG images
dataset in fold-1 (LR: 0.0001 and other hyperparameters are as in Table III).

TABLE VIII
MODELS COMPARISON

NP: normal person, AH: abnormal heartbeat, MI: myocardial infarction, H. MI: history
of myocardial Infarction classes.

average accuracy rate for the proposed CNN model shows


simi- lar high results when the RL values are changed. In
contrast, the pretrained SqueezeNet and AlexNet models show
poor results when the initial learning rate were 0.01 and 0.001,
but they start to show slightly good results when the LR is set Fig. 10. Confusion matrices of the proposed CNN model for classification of
to 0.0001. This is because, in transfer learning, the weights of heart diseases in the ECG images dataset for each fold (RL: 0.0001 and other
the pretrained models are not learned from scratch. Therefore, hyper-parameters are as in Table III).
to avoid getting stuck in local minima, it is better to start with
TABLE IX
a lower LR such as 0.0001 when applying transfer learning PROPERTIES OF THE EXTRACTED FEATURES FROM PRETRAINED NETWORKS
techniques.
The average accuracy rates are 96.79% and 95.43% for
AlexNet and SqueezeNet, respectively with RL of 0.0001. On
the other hand, the proposed CNN model also outperforms the
other models in terms of time cost, as can be seen in Table VI.
Although SqueezeNet has the smallest number of parameters
and is a fully CNN, it achieves the worst performance in terms
of time cost. This is because the number of computations in the
convolutional layers is very high, so it takes more time to be
respectively. They used a batch size of 24 and a learning rate
processed, especially when running on a single CPU platform.
Fig. 9 depicts the training progress of our proposed CNN of 0.0002 to train their model. Their training phase lasted
model on the ECG images dataset in fold-1 (LR = 0.0001). The almost 4 days. According to their paper, they achieved a high
precision rate for class MI, which is 98.3%, whereas our
accuracy rate increases gradually with each successive iteration.
proposed CNN model outperforms them with a precision rate of
Moreover, the loss decreases smoothly as the iteration progresses
99.4% for class MI. Table VIII compares the results from [22],
and reaches 0.0043.
in which the accuracy rates of each class were extracted from
The confusion matrices which were obtained for each fold
their confusion matrix, with our proposed CNN model.
after training our proposed CNN models with an RL value of
0.0001 on the ECG images dataset are shown in Fig. 10.
To the best of our knowledge, the only work in the B. Results of Using Pretrained Deep Learning Models As
literature that uses the same dataset and classifies the four a Feature Extractor
classes is the work in [22], which has been discussed in The pretrained SqueezeNet and AlexNet networks were used
Section II. In [22], the dataset was split as 80% and 20% for to extract the features of the ECG images in the dataset. As
training and testing,
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
380 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

well

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
ABUBAKER AND BABAYIG˘ IT: DETECTION OF CARDIOVASCULAR DISEASES IN ECG IMAGES USING MACHINE 381
LEARNING

TABLE X
CALCULATED PERFORMANCE MEASUREMENTS FOR MACHINE LEARNING ALGORITHMS THAT USE PRETRAINED NETWORKS SQUEEZENET, ALEXNET, AND
PROPOSED CNN AS FEATURES EXTRACTOR APPLIED ON ECG IMAGES DATASET

The bold values indicate the best results.

as, our proposed CNN model was used as a feature extractor VI. CONCLUSION
and the results were compared. The power of deep learning
can be used to extract image features without re-training the In this article, we propose a lightweight CNN-based model
entire network. The activations of the network are computed to classify the four major cardiac abnormalities, i.e., AH, MI,
by forward propagation of the input images up to the specific H. MI, and NP classes, using public ECG images dataset of
feature layer. The activation feature layers used are conv10 (layer cardiac patients. According to the results of the experiments,
number 64), fc7 (layer number 20) and fc02 (layer number the proposed CNN model achieves remarkable results in cardio-
32) for SqueezeNet, AlexNet and our proposed CNN model, vascular disease classification and can also be used as a
respectively. Table IX illustrates the characteristics of the ex- feature extraction tool for the traditional machine learning
tracted features. Then, these extracted features were used to classifiers. Thus, the proposed CNN model can be used as an
train the machine learning algorithms: SVM, k-NN, DT, RF, assistance tool for clinicians in the medical field to detect
and NB. cardiac diseases from ECG images and bypass the manual
The performance measures are calculated and presented in process that leads to inaccurate and time-consuming results.
Table X. As can be seen, the most successful result was obtained In the future work, optimization techniques can be used to
with a rate of 99.79% for the accuracy, recall, precision, and obtain optimized values for the hyperparameters of the proposed
F1-score of the NB algorithm when our proposed CNN model CNN model. The proposed model can also be used for predicting
was used as the feature extractor. The accuracy rates of other types of problems. Since, the proposed model belongs to
99.47%, 97.87%, and 97.66% were obtained by the SVM the family of low-scale deep learning methods in terms of the
algorithm when our proposed CNN model, SqueezeNet, and number of layers, parameters, and depth. Therefore, a study
AlextNet, respectively, were used to extract the features. As a on using the proposed model in the Industrial Internet of
result, the best achievements for all performance measures Things domain for classification purposes can be explored.
were obtained when using our proposed CNN model as the
feature extractor. When comparing SqueezeNet and AlexNet, we REFERENCES
almost achieved better accuracy rates for SVM, RF and NB [1] World Health Organization (WHO), “Cardiovascular diseases,” Jun. 11,
algorithms using the features extracted from SqueezeNet than 2021. Accessed: Dec. 27, 2021. [Online]. Available: https://www.who.
int/health-topics/cardiovascular-diseases
those from AlexNet. However, the training and testing times [2] Government of Westren Australia, Department of Health, “Com-
for SqueezeNet-based algorithms were longer due to the larger mon medical tests to diagnose heart conditions,” Accessed: Dec. 29,
size of the extracted features. Although the extracted feature 2021. [Online]. Available: https://www.healthywa.wa.gov.au/Articles/A_
E/Common-medical-tests-to-diagnose-heart-conditions
size of our proposed CNN model is the smallest, it achieved [3] M. Swathy and K. Saruladha, “A comparative study of classification
the best results on all performance measures, as shown in and prediction of cardio-vascular diseases (CVD) using machine
Table X. Therefore, this is an indication that our proposed learning and deep learning techniques,” ICT Exp., to be published,
2021. [Online].
model is built to learn the key features of the ECG images Available: https://doi.org/10.1016/j.icte.2021.08.021
dataset. Thus, the advantages of the proposed model are not [4] R. R. Lopes et al., “Improving electrocardiogram-based detection of
only the better accuracy rates but also the lower computational rare genetic heart disease using transfer learning: An application to
phos- pholamban p.Arg14del mutation carriers,” Comput. Biol. Med.,
costs compared to the works in the literature. However, the vol. 131, 2021, Art. no. 104262. [Online]. Available:
proposed model could achieve better results if optimization https://doi.org/10.1016/j. compbiomed.2021.104262
algorithms are used to determine the values of its [5] R. J. Martis, U. R. Acharya, and H. Adeli, “Current methods in electro-
cardiogram characterization,” Comput. Biol. Med., vol. 48, pp. 133–149,
hyperparameters. 2014. [Online]. Available: https://doi.org/10.1016/j.compbiomed.2014.
02.012

Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
382 IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. 4, NO. 2, APRIL
2023

[6] A. Rath, D. Mishra, G. Panda, and S. C. Satapathy, “Heart disease


[28] R. Bharti, A. Khamparia, M. Shabaz, G. Dhiman, S. Pande, and P.
detection using deep learning methods from imbalanced ECG samples,”
Biomed. Signal Process. Control, vol. 68, 2021, Art. no. 102820. Singh, “Prediction of heart disease using a combination of machine
[Online]. Avail- able: https://doi.org/10.1016/j.bspc.2021.102820 learning and deep learning,” Comput. Intell. Neurosci., vol. 2021, 2021,
Art. no. 8387680. [Online]. Available: https://doi.org/10.1155/2021/
[7] A. Mincholé and B. Rodriguez, “Artificial intelligence for the electro-
8387680
cardiogram,” Nature Med., vol. 25, no. 1, pp. 22–23, 2019. [Online].
Available: https://doi.org/10.1038/s41591-018-0306-1 [29] P. Bizopoulos and D. Koutsouris, “Deep learning in cardiology,” IEEE
[8] A. Isin and S. Ozdalili, “Cardiac arrhythmia detection using deep learning,” Rev. Biomed. Eng., vol. 12, pp. 168–193, 2018. [Online]. Available: https:
Procedia Comput. Sci., vol. 120, pp. 268–275, 2017. [Online]. //doi.org/10.1109/RBME.2018.2885714
Available: https://doi.org/10.1016/j.procs.2017.11.238 [30] S. Kiranyaz, T. Ince, and M. Gabbouj, “Real-time patient-specific ECG
[9] H. Bleijendaal et al., “Computer versus cardiologist: Is a machine learn- classification by 1-D convolutional neural networks,” IEEE Trans. Biomed.
ing algorithm able to outperform an expert in diagnosing phospholam- Eng., vol. 63, no. 3, pp. 664–675, Mar. 2016. [Online]. Available: https:
ban (PLN) p.Arg14del mutation on ECG?,” Heart Rhythm, vol. 18, //doi.org/10.1109/TBME.2015.2468589
no. 1, pp. 79–87, 2020. [Online]. Available: https://doi.org/10.1016/j. [31] M. Zubair, J. Kim, and C. Yoon, “An automated ECG beat classification
hrthm.2020.08.021 system using convolutional neural networks,” in Proc. 6th Int. Conf. IT
[10] U. R. Acharya, H. Fujita, O. S. Lih, M. Adam, J. H. Tan, and C. K. Convergence Secur., 2016, pp. 1–5. [Online]. Available: https://doi.org/
Chua, “Automated detection of coronary artery disease using different 10.1109/ICITCS.2016.7740310
durations of ECG segments with convolutional neural network,” Knowl.- [32] M. Sandler, A. Howard, M. Zhu, A. Zhmoginov, and L.-C. Chen, “Mo-
Based Syst., vol. 132, pp. 62–71, 2017. [Online]. Available: bilenetv2: Inverted residuals and linear bottlenecks,” in Proc. IEEE
https://doi.org/10.1016/j. knosys.2017.06.003 Conf. Comput. Vis. Pattern Recognit., 2018, pp. 4510–4520.
[11] M. Kantardzic, Data Mining: Concepts, Models, Methods, and Algorithms, [33] T. Rahman et al., “COV-ECGNET: COVID-19 detection using ECG trace
images with deep convolutional neural network,” 2021, arXiv:2106.00436.
3rd ed. Hoboken, NJ, USA: Wiley, 2020.
[12] S. García, J. Luengo, and F. Herrera, Data Preprocessing in Data Mining, [34] G. Huang, Z. Liu, L. V. D. Maaten, and K. Q. Weinberger, “Densely
1st ed. Berlin, Germany: Springer, 2015. connected convolutional networks,” in Proc. IEEE Conf. Comput. Vis.
[13] G. Dougherty, Pattern Recognition and Classification: An Introduction. Pattern Recognit., 2017, pp. 2261–2269.
[35] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna,
Berlin, Germany: Springer, 2013.
“Rethinking the inception architecture for computer vision,” in Proc.
[14] A. Subasi, Practical Machine Learning for Data Analysis Using Python.
IEEE Conf. Comput. Vis. Pattern Recognit., 2016, pp. 2818–2826.
Cambridge, MA, USA: Academic, 2020.
[36] A. Pal, R. Srivastva, and Y. N. Singh, “CardioNet: An efficient ECG
[15] J. Soni, U. Ansari, D. Sharma, and S. Soni, “Predictive data mining
arrhythmia classification system using transfer learning,” Big Data Res.,
for medical diagnosis: An overview of heart disease prediction,” Int. J.
vol. 26, 2021, Art. no. 100271. [Online]. Available: https://doi.org/10.
Comput. Appl., vol. 17, no. 8, pp. 43–48, 2011.
1016/j.bdr.2021.100271
[16] K. Dissanayake and M. G. Md Johar, “Comparative study on heart
[37] R. Avanzato and F. Beritelli, “Automatic ECG diagnosis using convo-
disease prediction using feature selection techniques on classification
lutional neural network,” Electronics, vol. 9, no. 6, 2020, Art. no. 951.
algorithms,” Appl. Comput. Intell. Soft Comput., vol. 2021, 2021, Art.
[Online]. Available: https://doi.org/10.3390/electronics9060951
no. 5581806. [Online]. Available: https://doi.org/10.1155/2021/5581806
[38] U. R. Acharya, H. Fujita, S. L. Oh, Y. Hagiwara, J. H. Tan, and M.
[17] A. H. Gonsalves, F. Thabtah, R. M. A. Mohammad, and G. Singh, “Pre-
Adam, “Application of deep convolutional neural network for
diction of coronary heart disease using machine learning: An
automated detection of myocardial infarction using ECG signals,” Inf.
experimental analysis,” in Proc. 3rd Int. Conf. Deep Learn. Technol.,
Sci., vol. 415– 416, pp. 190–198, 2017. [Online]. Available:
2019, pp. 51–56. [Online]. Available:
https://doi.org/10.1016/j.ins. 2017.06.027
https://doi.org/10.1145/3342999.3343015
[39] M. Naz, J. H. Shah, M. A. Khan, M. Sharif, M. Raza, and R.
[18] H. Kim, M. I. M. Ishag, M. Piao, T. Kwon, and K. H. Ryu, “A data mining
Damaševicˇius, “From ECG signals to images: A transformation based
approach for cardiovascular disease diagnosis using heart rate
ap- proach for deep learning,” PeerJ Comput. Sci., vol. 7, 2021, Art. no.
variability and images of carotid arteries,” Symmetry, vol. 8, no. 6, 2016,
e386, doi: 10.7717/peerj-cs.386.
Art. no. 47. [Online]. Available: https://doi.org/10.3390/sym8060047
[40] H. El-Amir and M. Hamdy, Deep Learning Pipeline: Building a Deep
[19] T. Ozcan, “A new composite approach for COVID-19 detection in X-
Learning Model With TensorFlow. New York, NY, USA: Apress
ray images,” Appl. Soft Comput., vol. 111, 2021, Art. no. 107669.
Media, 2020.
[Online].
[41] M. A. Hearst, S. T. Dumais, E. Osuna, J. Platt, and B. Scholkopf,
Available: https://doi.org/10.1016/j.asoc.2021.107669
“Support vector machines,” IEEE Intell. Syst. Appl., vol. 13, no. 4,
[20] F. N. Iandola, S. Han, M. W. Moskewicz, K. Ashraf, W. J. Dally, and
pp. 18–28,
K. Keutzer, “SqueezeNet: Alexnet-level accuracy with 50x fewer
Apr. 1998. [Online]. Available: https://doi.org/10.1109/5254.708428
parameters and< 0.5 MB model size,” 2016, arXiv:1602.07360. [42] M. Abubaker and W. M. Ashour, “Efficient data clustering algorithms: Im-
[21] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification
provements over Kmeans,” Int. J. Intell. Syst. Appl., vol. 5, no. 3, pp. 37–49,
with deep convolutional neural networks,” Adv. Neural Inf. Process.
2013. [Online]. Available: https://doi.org/10.5815/ijisa.2013.03.04
Syst., vol. 25, pp. 1097–1105, 2012.
[43] B. Charbuty and A. Abdulazeez, “Classification based on decision tree
[22] A. H. Khan, M. Hussain, and M. K. Malik, “Cardiac disorder classification
algorithm for machine learning,” J. Appl. Sci. Technol. Trends, vol. 2,
by electrocardiogram sensing using deep neural network,” Complexity,
no. 1, pp. 20–28, 2021.
vol. 2021, 2021, Art. no. 5512243. [Online]. Available:
[44] L. Breiman, “Random forests,” Mach. Learn., vol. 45, no. 1, pp. 5–32,
https://doi.org/10. 1155/2021/5512243
2001. [Online]. Available: https://doi.org/10.1023/A:1010933404324
[23] A. H. Khan and M. Hussain, “ECG images dataset of cardiac patients,”
[45] E. Miranda, E. Irwansyah, A. Y. Amelga, M. M. Maribondang, and
Mendeley Data, vol. V2, 2021. [Online]. Available: https://doi.org/10.
M. Salim, “Detection of cardiovascular disease risk’s level for adults
17632/gwbz3fsgp8.2
using naive Bayes classifier,” Healthcare Inform. Res., vol. 22, no. 3,
[24] C. Potes, P. Saman, A. Rahman, and B. Conroy, “Ensemble of feature-
pp. 196–205, 2016. [Online]. Available:
based and deep learning-based classifiers for detection of abnormal
https://doi.org/10.4258/hir.2016. 22.3.196
heart sounds,” in Proc. Comput. Cardiol. Conf., 2016, pp. 621–624.
[46] G. Masetti and F. D. Giandomenico, “Analyzing forward robustness of
[25] A. Nannavecchia, F. Girardi, P. R. Fina, M. Scalera, and G. Dimauro,
feedforward deep neural networks with LeakyReLU activation function
“Personal heart health monitoring based on 1D convolutional neural
through symbolic propagation,” in Proc. Joint Eur. Conf. Mach. Learn.
network,” J. Imag., vol. 7, no. 2, 2021, Art. no. 26. [Online]. Available:
Knowl. Discov. Databases, 2020, pp. 460–474.
https://doi.org/10.3390/jimaging7020026
[47] S. Shahinfar, P. Meek, and G. Falzon, “How many images do I need?”
[26] Q. Zhang, D. Zhou, and X. Zeng, “HeartID: A multiresolution convolu-
Understanding how sample size per class affects deep learning model
tional neural network for ECG-based biometric human identification in
performance metrics for balanced designs in autonomous wildlife mon-
smart health applications,” IEEE Access, vol. 5, pp. 11805–11816,
itoring,” Ecological Inform., vol. 57, 2020, Art. no. 101085. [Online].
2017. [Online]. Available:
Available: https://doi.org/10.1016/j.ecoinf.2020.101085
https://doi.org/10.1109/ACCESS.2017.2707460
[48] B. Zoph, E. D. Cubuk, G. Ghiasi, T. Lin, J. Shlens, and Q. V. Le, “Learning
[27] U. R. Acharya, S. L. Oh, Y. Hagiwara, J. H. Tan, M. Adam, and R. S.
data augmentation strategies for object detection,” in Proc. Eur. Conf.
Tan, “A deep convolutional neural network model to classify
Comput. Vis., 2020, pp. 566–583.
heartbeats,” Comput. Biol. Med., vol. 89, pp. 389–396, 2017. [Online].
Available: https:
//doi.org/10.1016/j.compbiomed.2017.08.022
Authorized licensed use limited to: VTU Consortium. Downloaded on February 29,2024 at 19:24:23 UTC from IEEE Xplore. Restrictions apply.
IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021 2502809

A Multitier Deep Learning Model for


Arrhythmia Detection
Mohamed Hammad , Abdullah M. Iliyasu , Senior Member, IEEE, Abdulhamit Subasi ,
Edmond S. L. Ho , and Ahmed A. Abd El-Latif

Abstract— An electrocardiograph (ECG) is employed as a main cause of deaths globally [1]. An estimated 17.9 million
primary tool for diagnosing cardiovascular diseases (CVDs). succumbed to CVD-related ailments, representing 31% of all
ECG signals provide a framework to probe the underlying deaths worldwide in the same year. Two-thirds of these deaths
properties and enhance the initial diagnosis obtained via
traditional tools and patient–doctor dialogs. Notwithstanding its occurred in low-income countries [1] where medical facilities
proven utility, deciphering large data sets to determine for early detection and supports for patients of CVD are
appropriate information remains a challenge in ECG-based CVD deemed generally poor.
diagnosis and treatment. Our study presents a deep neural Arrhythmia is a situation that arises when a person’s
network (DNN) strategy to ameliorate the aforementioned heart pacemaker does not work properly, or its functions are
difficulties. Our strategy consists of a learning stage where
classification accuracy is improved via a robust feature impaired by ectopic focuses [2]. There are several diagnostic
extraction protocol. This is followed by using a genetic methods available to detect CVDs. Electrocardiography (ECG)
algorithm (GA) process to aggregate the best combination of is the most well-known and widely applied method for the
feature extraction and classification. Comparison of the detection of various heart diseases [3]. ECG is an affirmed
performance recorded for the proposed technique alongside
method for the detection of acute coronary syndromes, intra-
state-of-the-art methods reported the area shows an increase
of 0.94 and 0.953 in terms of average accuracy and F1 score, ventricular conduction disturbances, and arrhythmias [4].
respectively. The outcomes suggest that the proposed model ECG lead refers to an imaginary line between two ECG elec-
could serve as an analytic module to alert users and/or medical trodes [5]. The standard ECG has 12 leads, of which six leads
experts when anomalies are detected. are placed on the arms and/or legs of the individual, and called
Index Terms— Advancement of medical instrumentation limb leads, while the remaining leads are placed on the torso
(AAMI) standard, arrhythmia detection, cardiovascular diseases and are referred to as precordial leads. The limb leads are
(CVDs), deep neural network (DNN), E-healthcare devices, elec- labeled as I, II, III, aVL, aVR, and aVF, while the precordial
trocardiograph (ECG), genetic algorithm (GA).
leads are similarly labeled as V1, V2, V3, V4, V5, and V6.
Overall, ECG has valuable potential to reveal hidden
disease features. However, the manual analysis of the long-
I. INTRODUCTION term ECG signals is a tiresome task even for an expert. Hence,

A CCORDING to the World Health Organization (WHO),


as of 2016, cardiovascular diseases (CVDs) are the
developing a computer-aided cardiac diagnosis (CACD)
system helps clinicians in obtaining a second opinion
regarding cardiac diagnosis, and they serve as tools supporting
Manuscript received May 10, 2020; revised August 6, 2020; accepted
October 2, 2020. Date of publication October 26, 2020; date of current
the decline of diagnostic errors in cardiology [6].
version December 22, 2020. This work was supported in part by Prince Several CACD systems have been developed to support
Sattam Bin Abdulaziz University, Saudi Arabia, via the Deanship for different stages of CVD diagnosis and treatment based on
Scientific Research funding for the Advanced Computational Intelligence and
Intelligent Systems Engineering (ACIISE) Research Group, under Project
machine learning (ML) strategies. Most classical ML methods
2019/01/9862. The Associate Editor coordinating the review process was are based on the extraction of features from different sig-
Sheng-Fu Liang. (Corresponding author: Abdulhamit Subasi.) nal types, typically ECG, which are subsequently processed
Mohamed Hammad is with the Faculty of Computers and Infor-
mation, Menoufia University, Shebeen El-Kom 32511, Egypt (e-mail:
using different algorithms, such as random forest [7] and
mohammed.adel@ci.menofia.edu.eg). support vector machines (SVMs) [8]. Similarly, employing
Abdullah M. Iliyasu is with the Electrical Engineering Department, College convolutional neural networks (CNNs), unsupervised feature
of Engineering, Prince Sattam Bin Abdulaziz University, Al-Kharj 11942,
Saudi Arabia, also with the School of Computing, Tokyo Institute of Tech-
extraction mechanisms have been used in the classification
nology, Yokohama 226-8502, Japan, and also with the School of Computer of signals. While effective in its use to classify such signals,
Science and Technology, Changchun University of Science and Technology, little has been invested in understanding the intrigues in
Changchun 130022, China (e-mail: a.iliyasu@psau.edu.sa). CNN’s automated classification of the extracted features.
Abdulhamit Subasi is with the Institute of Biomedicine, Faculty
of Medicine, University of Turku, 20520 Turku, Finland (e-mail: Meanwhile, advances in terms of available computational
abdulhamit.subasi@utu.fi). tools and algorithms have revealed that their use in automated
Edmond S. L. Ho is with the Department of Computer and Information Sci- early detection and diagnosis of cardiac abnormalities is on
ences, Northumbria University, Newcastle upon Tyne NE1 8QH, U.K. (e-
mail: e.ho@northumbria.ac.uk). the rise. Recently, focus on ECG rhythm (ECGr) classification
Ahmed A. Abd El-Latif is with the Mathematics and Computer Science has similarly been on the increase. ECGr classification can be
Department, Faculty of Science, Menoufia University, Shebeen El-Kom grouped into areas that focus on finding effective extraction
32511, Egypt, and also with the School of Information Technology and Com-
puter Science, Nile University, Giza, Egypt (e-mail: a.rahiem@gmail.com). methods [9], improving classification outcomes [10]–[14], and
Digital Object Identifier 10.1109/TIM.2020.3033072
1557-9662 © 2020 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission.
See https://www.ieee.org/publications/rights/index.html for more information.

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
2502809 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021

utilization of deep learning methods to enhance the perfor-


mance of classification [15]–[18].
Akhmani et al. [11] presented a method based on
the Gaussian mixture modeling (GMM) with enhanced
expectation–maximization (EM) for arrhythmia detection.
They obtained an accuracy of 99.7% for arrhythmia classi-
fication. Hammad et al. [12] reported the use of a classifier
based on characteristics of ECG signals to detect abnormal
heart conditions. As reported therein, their strategy yielded
an average classification accuracy of 99%. In their contribu-
tion, Tuncer et al. [14] presented an automated method for
arrhythmia detection using hexadecimal local patterns (HLPs) Fig. 1. Outline of the proposed multitier DLM.
and discrete wavelet transform (DWT). For classification, they
used a one-nearest neighborhood (1NN) classifier and data set available, i.e., the MIT-BIH arrhythmia [21]. Conse-
reported an accuracy of 99.7%. quently, the main contributions of this study are summarized
Despite excelling in suppressing classification errors, in the as follows:
face of big data of ECG records, the reported ML methods
1) design of an optimized DNN model for feature learning
(i.e., [10]–[14]) might be less effective. This is attributed to
required to distinguish different cardiac rhythms using a
the inherent shortcoming associated with training ML models
single lead ECG;
on limited or small data sets. Among others, important
2) integrating LSTM-based features with a k-nearest neigh-
differences between our study and those enumerated earlier
bor (k-NN) classifier to improve the classification
include the following.
efficacy;
1) Unlike the focus of most of the highlighted studies
3) design of a new DNN method based on the cross-
(i.e., [10]–[14]) on designing preprocessing of ECG
validation combined with GA for optimization of fea-
signals, feature extraction, feature selection, and clas-
tures and parameters.
sification protocols, this work proposes a DNN model
To the best of our knowledge, this is the first attempt at
optimized using genetic algorithm (GA) to aggregate the
arrhythmia detection in the manner enumerated above. The
best combination of feature extraction and classification.
outcomes show promising results in terms of detection accu-
2) As widely established, data inadequacy is crucial for
racy, sensitivity, specificity, positive predictivity, and F1-Score.
the learnability of machine and deep learning models
The flow of the remainder of the study is outlined as
(DLMs) [19]. Unlike the reported use of average-sized
follows. The details of the proposed techniques and data
data sets in [12]–[14], which manifests in their
sets employed throughout its execution and validation are
validation on big data sets, the proposed study exhibits
discussed in Section II. The presentation of the performance
the same performance on both small and big data sets.
analysis and discussion of outcomes are given in Section III.
3) Although with its own merits, some of the highlighted
Conclusions are drawn in Section IV.
methods employed multiple ECG recordings, which
increases the complexity of the respective methods [11], II. PROPOSED M ETHODOLOGY
[12]. To overcome this, the proposed employs only one The proposed technique fuses the adaptability and
lead ECG. flexibility in input–output relationships of deep neural
4) Unlike [10], [12], and [13], where classification was network (DNN) models with the “learnability” of classical
confined to one or two types of arrhythmia, our ML methods and repeatability inherent to the mutation,
proposed model is employed to classify five arrhythmia crossover, and other properties of GA and other optimization
categories. techniques to realize a prodigious yet efficient strategy for
To overcome the shortcomings attributed to the high- arrhythmia detection.
lighted ML techniques, DLMs are used. In fact, today DLMs Execution of the proposed strategy entails feeding the ECG
are so ubiquitous that their applications traverse different signal into the DNN model where deep features of each
domains [19], including the applications in auspicious medical patient are extracted. Next, these features are fed into a GA
areas [20]. Specific to arrhythmia detection, numerous meth- that determines their optimum combination. Following that,
ods have been reported [15]–[18]. In addition to the studies several classifiers, including k-NN, SVM, and multilayer
highlighted earlier (i.e., [10]–[14]), some of the shortcomings perceptron (MLP), are utilized to classify the features,
in the studies on arrhythmia detection will also be ameliorated following which final CVD detection is realized. Fig. 1
as part of the contributions of this study. presents the general outline of the proposed technique as
To accentuate, the work presented in this study is tailored explained. The remainder of this section presents the details of
toward the automated detection of CVD ailments based on the three (i.e., the deep learning, GA, and traditional ML) tiers
ECG signals. Especially, a DLM is suffused with other ML that make up the proposed technique.
and optimization (i.e., ResNet-LSTM+GA) techniques for
efficient detection of five types of arrhythmia based on the A. Proposed Deep Learning Model
association for the advancement of medical instrumentation
DNN is a class of artificial neural networks ingrained with
(AAMI) standards using the most standard ECG classification
mathematical manipulation to turn an input state into output
Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

via unitwise calculation of the probability of each output [22]. ReLU activation layer
Each mathematical manipulation is considered a layer of the
neural network and so, in the case of complex architectures,
the network requires a deep layer of computations, hence the
name DNN.
As the features for ECG classification are usually mani-
fested in the morphology of the ECG waveforms, algorithms
for feature extraction should be crafted to characterize ECG
waveforms by a set of parameters. The convolution operation
in a CNN model has been proven effective in the extraction of
features from 1-D or 2-D data that exhibit good robustness to
noise [23]. The residual CNN (ResNet), which is an improved
version of CNN, augment a known drawback regarding the
problem of degradation associated with DNNs by adding
shortcut links between its layers. Therefore, a ResNet is
potentially viable for extraction of the features from the raw
ECG waveforms.
However, an ECG recording used to diagnose CVD
ailments could extend to tens of seconds in duration. As a
result, mor- phological features of ECG recordings can be
very complex and hard to characterize. Moreover, an average
segment of ECG recording is considered enough to make a
diagnosis since parts of it are either irrelevant or redundant.
Consequently, it is neither effective nor expedient to rely
solely on ResNet. In view of this, the proposed DLM utilizes
ResNet for local feature extraction from the raw ECG signals
while using other network components, such as long short-
term memory (LSTM) layer to summarize the local feature
series. Further- more, the proposed DLM ResNet-LSTM
network, whose main function is to extract ECG features, is
structurally composed of three parts: local features learning,
global features learning, and classification units. Fig. 3
presents the detailed structure of the proposed ResNet-LSTM
DLM, and the details of its three units are presented in the
sequel.
1) Local Feature Learning (LFL) Unit: This part of the
proposed DLM is focused on the raw ECG signals. A local
feature vector manifests the morphological information of a
short period in an ECG recording. The resulting feature map
is composed of a sequence of local features ordered by time.
As discussed earlier, in this study, the LFL unit is
implemented using ResNet. It consists of a few initial layers,
while its main body is made up of repeating substructures. As
presented in Fig. 2, each substructure consists of one max-
pooling layer whose size is present at 2 and a residual module.
The length of the feature map will be split through each of the
substructures whose number depends in part on the input
length such that a longer input requires more pooling layers to
compress the feature map to a certain length. Each residual
module contains two convolutional layers, each preceded by
two layers: a rectified linear unit (ReLU) activation layer and
a dropout layer. Through a shortcut connection, the input of a
residual module is merged by combining it with the output of
its second convolutional layer. As required by the merge
operation and to ensure equal input and output length, feature
maps are padded before input into each convolutional layer.
The kernel size of the first convolutional layer in the network
is set at 32, and through every four substructures, the kernel
size is reduced by half. The LFL unit terminates with a
Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

Fig. 2. Architecture of the proposed DLM.

where the feature maps are fed as input to the global features
learning part.
2) Global Feature Learning Unit: The global feature
learn- ing (GFL) unit transforms the feature map from the
preceding LFL unit into a global vector that is subsequently
used in the classification unit. The LSTM, which is a kind of
recurrent neural network (RNN), is used to characterize the
properties of the global vector that emanates from the final
layer of the LSTM. This vector’s length is determined by the
hidden units in LSTM layers (preset at 64 in this study);
at that stage, the test samples achieved the minimum
classification error using this number.
3) Classification Unit: The classification process is the
final step of the proposed DLM, whence classification
process is done based on the global feature vector extracted
from preceding units. Classification is accomplished using
two fully connected (i.e., dense) layers that are each followed
by a ReLU activation layer and a SoftMax activation layer,
respectively. In the case of multiclass classification, the
number of cells in the last dense layer is the same as the
number of classes. However, in the two-class classification,
the last dense layer usually has just one cell. The outputs
of the last layer are the predicted probabilities showing the
class that each ECG recording belongs to. Although
traditional DNN models can make predictions in an end-to-
end fashion, to improve classification performance, an
optimization layer is integrated into the proposed DLM,
whose details are discussed in Section II-B.

B. GA-Based Optimization Tier


A high-dimensional feature set perturbs classification
accuracy while imposing temporal constraints on available

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
2502809 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021

TABLE I
DEFAULT CHOICE OF BEST PARAMETERS FOR GA-BASED OPTIMIZATION

Fig. 3. Impact of changing parameter k on the system accuracy.

resources. A wide range of approaches, such as GA [24]


and particle swarm optimization (PSO) [25], is employed as belonging to the category of those points. As a drawback,
to mitigate these encumbrances. In this study, a GA is however, the k-NN is sensitive to errors during the training
infused into the DLM discussed earlier with the objective of sequence [27]. In this study, the k-NN classifier with k= 5
minimizing the number of features and classification errors is employed. Fig. 3 depicts the k selection criterion where
associated with the variability of signal characteristics and preference is given to a value that yields the highest accuracy.
random permutation of the signals. 2) SVM Classifier: The SVM is another type of supervised
Moreover, recently, GA has been found very adaptive and learning algorithm that is employed for regression and
efficient for feature selection [26]. Typically, GA has four classifi- cation problems by finding a hyperplane that splits
steps, and its use as the optimization tier of the proposed the features into diverse domains [28]. When employed in
technique is outlined in the following steps. classification tasks, the SVM is called support vector
1) Initialize a population that consists of N chromosomes, classification (SVC). Similarly, when SVM is used in
each of length L. regression problems, the SVM is called support vector
2) Select optimum features from the feature space com- regression (SVR). Irrespective of where it is used, SVM can
prising of 36 different features, which can be defined as be broadly classified into two main types: linear SVM (L-
the initial population in the GA optimization procedure. SVM) for two-class problems and non-L-SVM (N-SVM) for
From the feature space, the features that have higher multiclass problems. This study is built on the N-SVM, where
fitness values (as measured by a fitness function) will the classification is accomplished via a kernel function to
be eliminated, whereas those with lower fitness values map the data into a different space with a hyperplane. A
will be retained. Kernel function can be chosen from the different types
3) In each generation, select two parents using the classi- available, such as linear, polynomial, and radial basis function
fiers to categorize the feature combination of each of (RBF). However, the choice is guided by the kind of
these parents separately. classification problem. Constrained by limitations of data set
4) Calculate the fitness value of each classification and available, RBF kernel, where the number of observations is
terminate the optimization when the generation passes larger than the number of features chosen, is used in this
5) the
Send100th iteration. parents to the crossover stage, and
the selected study. Formally, the RBF (Gaussian) kernel is defined as
follows [29]:

continue the optimization until the generation meets ǁx − xi


K(x, xi ) = exp (1)
the defined number of iterations. A default crossover ǁ2

2σ 2
probability of 0.8 used to choose parents with lower points is closer than the rest, the test point will be considered
fitness values to generate the next population. Table I
presents the default parameter settings for the proposed
GA-based optimization procedure.

C. Classification Tier of Proposed Model


In this study, classification is realized using several classi-
fiers, such as k-NN, SVM, and MLP. These classifiers were
implemented and evaluated to choose a suitable classifier for
our model, as outlined in the remainder of this section.
1) k-NN Classifier: The k-NN is a supervised ML algorithm
that is credited with ease of deployment and low tempo-
ral demands. The k-NN algorithm performs the test point
classification based on the surrounding training points, i.e.,
the neighbors closest to the test point (hence, the name nearest
neighbors). When the distance of some of these neighboring
Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
2502809 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021
where σ is a real value standard variance of the Gaussian
distribution, and each xi R p is a p-dimensional real vector. ∈
In this study, a default value of σ 1 is used. =
3) MLP Classifier: Multilayer perceptron (MLP) is a class
of feed-forward artificial neural networks that consist of three
layers, the input layer, a hidden layer, and an output layer.
Except for the input nodes, each node is a neuron that uses a
nonlinear activation function (e.g., sigmoid function). In this
study, an MLP classifier with one hidden layer and five
output nodes is used for arrhythmia detection used. Layers in
the network are completely connected to each other and
trained in a way that each input vector results in an output
vector with one nonzero element corresponding to the
estimated class label. For training, the Levenberg–Marquardt
backpropagation algorithm [30] is used. The learning
procedure is continued until either 30 validation failures are
obtained or when the maximum number of iterations (100
epochs) is reached.

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

Fig. 4. Samples of normal and abnormal classes from the MIT-BIH data set [21].

III. EXPERIMENTS AND VALIDATION TABLE II


DISTRIBUTION OF DATA SAMPLES FOR EACH OF THE
As mentioned earlier, a fivefold cross-validation FIVE TYPES OF ARRHYTHMIA
method [31] is employed in this study, and the performance
of the system was evaluated in each fold. The average
result of all the five folds was calculated as the final
performance of the system.
The performance of the proposed DLM was assessed in
three steps. First, the impact of using fivefold cross-validation
on an end-to-end model was evaluated. Second, the role
of proposed GA-based optimization on the classification is
assessed. Finally, outcomes of the classification were com-
pared alongside standard techniques in the area of automated predictivity (PPV), and specificity (SPE). These parameters
detection of cardiac abnormalities, which is an important step are defined in the equation matrix in Table III.
in CVD diagnosis and treatment. In addition, F1-score defined in (2) [32] is used to evaluate
The data
proposed set employed
model and metrics
are introduced used insections.
in subsequent validating the the classification

⎛ N 2TP
1 M
i 2TP+FN+FP

A. MIT-BIH Arrhythmia Data Set F 1 − score = ⎝ N
(2)
M i
The MIT-BIH database [21] contains 48 ECG recordings
obtained from 47 subjects composed of 47% female and 53% where N and M represent the number of sets applied in the
male participants whose age range varied between 23 and fivefold and the number of classes, respectively. TP and TN
89 years. Each subject is represented by one ECG recording are true positives and true negatives, and FP and FN are false
that is obtained using two leads placed on the chest. The positives and false negatives
lead II (MLII), which is at the top and lead V1, which is the
TP
lower one, produced the signals at a sampling frequency of /N (3)
360 Hz. As explained in [26], in the upper signal, the normal
N
TP + FP
Positive Predictivity (PPV) =
QRS complexes are usually prominent, while, in some cases /N (4)
TP
(such as in recordings 102 and 104), surgical dressings on the Sensitivity (SEN) = N
patients prevented the use of lead II, so, in this case, lead TP + FN
V5 was used. TN
N /N (5)
According to the AAMI specifications, the MIT-BIH data- Specificity (SPE) = TN + FP
base can be grouped into five arrhythmia groups: normal (N),

supraventricular ectopic (S), ventricular ectopic (V), fusion TP+TN


(F), and unknown (Q). The distribution of the data over the Accuracy (Acc) = N /N.
TP+TN+FP+FN
training and testing sets for each of the five types of
arrhythmia is presented in Table II, while Fig. 4 presents (6)
samples of three recordings (i.e., normal and other abnormal
cases) from the
MIT-BIH database.
Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809
B. Performance Metrics C. Preprocessing and Implementation Details
The classification results were evaluated using standard met- Since ECG recordings in the selected data set are dispro-
rics, including the Accuracy (Acc) sensitivity (SEN), positive portionate in length, the first preprocessing operation is that
to convert them to the same length by padding or truncating
for the convenience of DNN training. However, the choice

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
2502809 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021

TABLE III
COMPARISON OF INTRAPATIENT’S CLASSIFICATION PERFORMANCE OF USING THE MIT-BIH DATABASE

of a padding method can increase the computing complex- D. Results and Performance Analysis
ity of the model, while the truncation method can damage
the recording integrity. Moreover, 90% of recordings in the In this section, the results of experiments and performance
selected database are no longer than 30 s in length. In view of of the proposed model are presented and discussed.
this, as a tradeoff between computing efficiency and recording Especially, the proposed models are validated via three
integrity, 30-s-long recordings are chosen as the target length. experiments. In the first experiment, the proposed end-to-end
Furthermore, a zero-padding value was used because it is the model is employed without any ML stages. In the second
baseline value of the ECG signals. The padding was experiment, the proposed deep model is used for feature
positioned at the head of each recording because LSTM is extraction, and an external classifier (k-NN classifier) is
considered more sensitive to values in the recording tail. employed for classifica- tion. In the last experiment, a
Meanwhile, for the truncation, the model uses the same comparison of the two proposed models (i.e., end-to-end and
method that truncates a segment randomly from the original DLM with external classifier) alongside state-of-the-art
signal. In addition, other fixed-length recordings (such as 10 approaches reported in the literature. As discussed earlier,
and 20 s) were considered, but the 30-s-length recordings based on the AAMI specification EC 57 [33], using the
remained the optimal choice. MIT-BIH database [21], arrhythmia is con- sidered as the beat
The randomness involved in the padding/truncation methods level that can be classified as N, S, V, F, and Q classes. Each
augments and balances the data set during this process. How- beat contains 300 sampling points: 100 = before and 200 after
ever, considering the additional memory requirements the R peak (with Fs 360 Hz). The lead II
imposed by the augmentation, the data augmentation and data are used for the classification, so the channel number for
balancing are done in batches. For each model training, a the input is 1. Four residual substructures in the DLM (i.e.,
batch is generated by randomly selecting a certain number of ResNet-LSTM) model produce a local feature map of length
recordings from each class and then padding or truncating 18. Since this is a multiclass and single-label classification
these recordings as the case may demand. For example, for an problem, SoftMax is used as the final activation function.
adopted batch size of 63 and a class numbers of 5, a batch Furthermore, both intrapatient and interpatient models are
contains seven record- ings from each class. The randomness trained for this problem. For the training of intrapatient mod-
in the padding (except that for the ResNet-LSTM) and els, the beats from all recordings are first shuffled and divided
truncation ensure that, with the exception of the ResNet- into five segments for the cross-validation, whereas, for the
LSTM, no two training samples are the same. Furthermore, no training of intrapatient models, the beats from 22 recordings
additional memory is required for the augmented recordings are used for training and another 22 recordings for validation,
because they are generated just prior to preparing a batch and as stipulated in the AAMI standards. However, since the beat
discarded immediately after processing of the batch. numbers of classes F and Q are small, only the other three
As stated earlier, the recordings are padded or truncated classes (i.e., N, S, and V) are involved in the interpatient
to 30 s, which adds up to 15 000 sampling points. The local classifications. The results of the intrapatient and interpatient
features learning pipeline of the proposed ResNet-LSTM has models are presented in Tables III and IV, respectively.
seven residual substructures. As each substructure has a max- From Tables III and IV, it can be deduced that GA optimized
pooling layer with a pool size of 2, the resulting output length the features of the proposed DLM better than other methods.
of the local features learning pipeline is set at 117. Since a Similarly, it can be inferred that k-NN is better suited for
recording may have more than one label, the resulting task GA optimization since it produced better accuracy relative to
is a multilabel classification problem. Consequently, as out- other classifiers. Figs. 5 and 6 present the graphs showing
lined in Section III, SoftMax is used as the final activation the validation of the proposed k-NN ML model with and
function that generates the predicted probability for each class without using GA-based optimization. A reading of the two
independently. plots confirms the choice of the GA-optimized strategy as
The models are implemented on the Keras framework more efficient.
with a Tensorflow back end. The hardware environment is
a workstation equipped with an Intel Core i7-6800K CPU, E. Comparison With Similar State-of-the-Art Methods
an Nvidia GTX 1080ti GPU, and 16-GB memory, while the In this section, the performance of the proposed techniques
training time of each batch for ResNet-LSTM is 307 ms. is evaluated alongside longstanding methods in the area. For

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

TABLE IV
COMPARISON OF INTERPATIENT’S CLASSIFICATION PERFORMANCE OF USING THE MIT-BIH DATABASE

TABLE V
COMPARISON OF PERFORMANCE PROPOSED MODEL ALONGSIDE
REPORTED STUDIES THAT USE THE MIT-BIH DATABASE

Fig. 5. Plot of the proposed ResNet-LSTM with GA when using k-NN as


a classifier (the best classifier).

Fig. 6. Plot of the proposed ResNet-LSTM without GA when using k-NN


as a classifier (the best classifier).

a level playing ground, outcomes with the best performance


are used for the assessment. For this study, this is the DLM
suffused with k-NN and GA-based optimization.
From the results that the comparison presented in Table V,
it can be concluded that the proposed method matches or bet-
ters the other methods in terms of robustness for the data
set reported. As noted earlier, as a motivation for embark-
ing on this study, while it was observed that there are
a good number of machine or deep learning approaches
for detecting heart disorders (such as arrhythmia), most
of them are encumbered by the computational overhead
associated with the complex frameworks utilized in their
detection models [10], [11], [13]–[18]. Many of these frame-
works are slow [15]–[18], while others are overburdened by

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

TABLE IV
COMPARISON OF INTERPATIENT’S CLASSIFICATION PERFORMANCE OF USING THE MIT-BIH DATABASE

memory-related constraints [10]–[13]. Furthermore, most of


the developed models are especially primed to detect only
one type of signal. Unlike these previous studies, a multitier
DLM

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
2502809 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 70, 2021

TABLE VI
with ML and GA-based optimization for effective discrimi-
COMPARISON BETWEEN COMPUTATIONAL COMPLEXITY OF LSTM AND
BILSTM DLMS IN ECG-BASED ARRHYTHMIA DETECTION nation of cardiac abnormalities in the ECG signal. The pro-
posed techniques fuse the adaptability and flexibility in input–
output relationships of DNN models with the “learnability”
of classical ML methods and repeatability inherent to the
mutation, crossover, and other properties of GA and other
optimization techniques to realize a prodigious yet efficient
strategy for early detection of different CVD ailments. These
properties ensure that the proposed approach alleviates many
of the shortcomings that encumber traditional approaches. The
capable of detecting more than one type of signal is proposed.
outcomes show that the proposed model matches and outper-
Its use in detecting heart disorders, such as arrhythmia, is
forms many of the competing approaches in either or both
demonstrated.
the data sets used. Moreover, with average accuracy values
In addition, the bidirectional long-short term memory net-
of 98%, the proposed technique is efficient in arrhythmia
work (BiLSTM) method is reported to perform creditably for
detection on the MIT-BIH data set. Furthermore, the perfor-
arrhythmia detection [35], [36]. Compared with our proposed
mance was reported in terms of specificity (98.9%), sensitivity
model (see Table V), the BiLSTM method in [35] offers
(99.7%), and positive predictivity (95.8%) for the fivefold
marginally better performance in detection accuracy.
cross-validation. The metrics validate the potentials for incor-
However, Li et al. [35] report detecting RR intervals, which
porating the proposed model in state-of-the-art applications
increases computational overhead. Furthermore, the method is
for CVD detection, as well as its subsequent diagnosis,
more susceptible to noisy signals, and its accuracy is data-
treatment, and management. In ongoing work, we are
intensive since large amounts of ECG data are required. In
exploring effective techniques to fuse the proposed method
addition, it requires double LSTM cells, which makes it
into other aspects of the e-health framework. In future work,
costlier. Con- sequently, the time complexity of [35] is
we intend to exploit the potency of the BiLSTM method to
potentially prohibitive because of the complexity of
enhance other aspects of CVD detection.
BiLSTM.
Meanwhile, the intuition to suffuse GA-based optimization
into the proposed DLM ensures that (the best) lower features REFERENCES
are extracted from the ECG signals of more than one lead, [1] V. K. Sudarshan, U. R. Acharya, and S. L. Oh, “Automated diagnosis of
despite the use of the lead II ECG signals. This suggests that congestive heart failure using dual tree complex wavelet transform and
statistical features extracted from 2, s of ECG signals,” Comput. Biol.
the proposed method is less complex than other competing Med., vol. 83, pp. 48–58, May 2011.
techniques. The proposed model requires four hours for train- [2] N. Singh and P. Singh, “Cardiac arrhythmia classification using
ing with a computational complexity (defined in terms of the machine learning techniques,” in Engineering Vibration,
Communication and Information (Lecture Notes in Electrical
decision time for each recording) of 10 ms. Engineering), vol. 478. Singapore: Springer-Verlag, 2019, pp. 469–
Finally, as presented in Table V, for the data sets employed, 480.
the proposed technique outperforms similar ones in terms of [3] M. Liu and Y. Kim, “Classification of heart diseases based on ECG
classification accuracy, which is an important precursor for signals using long short-term memory,” in Proc. 40th Annu. Int. Conf.
IEEE Eng. Med. Biol. Soc. (EMBC), Jul. 2018, pp. 2707–2710.
arrhythmia detection and subsequent diagnosis. [4] P. Kligfield et al., “Recommendations for the standardization and inter-
pretation of the electrocardiogram: Part I: The electrocardiogram and its
technology: A scientific statement from the American Heart Association
F. Complexity Analysis Electrocardiography and Arrhythmias Committee, Council on Clinical
Cardiology; the American College of Cardiology Foundation; and the
To evaluate the complexity of our proposed model, the Heart Rhythm Society,” Circulation, vol. 115, no. 10, pp. 1306–1324,
CPU time required to execute each phase is computed, as Mar-2007.
presented in Table VI. Therefore, we note that, in the worst [5] Lewis Potter. (Mar. 5, 2011). Understanding an ECG.
Accessed: Jul. 13, 2020. [Online]. Available: https://geekymedics.
case, the cost of the LSTM amounts to (O(n2)). com/understanding-an-ecg/
Meanwhile, this cost is half that expected for the BiLSTM [6] N. Khosravan, H. Celik, B. Turkbey, E. C. Jones, B. Wood, and
method (as reported in the rightmost column of Table V). U. Bagci, “A collaborative computer aided diagnosis (C-CAD) system
with eye-tracking, sparse attentional model, and deep learning,” Med.
Consequently, it is imperative that the marginal improvement Image Anal., vol. 51, pp. 101–115, Jan. 2019.
in terms of prediction accuracy for the BiLSTM model (as [7] L. Breiman, “Random forests,” Mach. Learn., vol. 45, no. 1, pp. 5–32,
reported earlier in Table V) over the proposed LSTM DLM 2001.
[8] Y. Freund and R. E. Schapire, “Experiments with a new boosting
with GA classifier comes at the expense of increases in
algorithm,” in Proc. ICML, vol. 96, 1996, pp. 148–156.
computational overhead. We believe this tradeoff between [9] M. Hammad, S. Zhang, and K. Wang, “A novel two-dimensional ECG
cost and marginal improvement in detection accuracy must be feature extraction and classification algorithm based on convolution
carefully considered depending on the application. neural network for human authentication,” Future Gener. Comput. Syst.,
vol. 101, pp. 180–196, Dec. 2019.
[10] D. Sadhukhan, S. Pal, and M. Mitra, “Automated identification of
IV. CONCLUSION myocardial infarction using harmonic phase distribution pattern of ECG
data,” IEEE Trans. Instrum. Meas., vol. 67, no. 10, pp. 2303–2313,
Efficient and accurate classification of ECG signals is the Oct. 2018.
first important step in the detection and diagnosis of many [11] R. Ghorbani Afkhami, G. Azarnia, and M. A. Tinati, “Cardiac arrhyth-
CVD ailments. This study presents a multitier DLM suffused mia classification using statistical and mixture modeling features of
ECG signals,” Pattern Recognit. Lett., vol. 70, pp. 45–51, Jan. 2016.
Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.
HAMMAD et al.: MULTITIER DLM FOR ARRHYTHMIA DETECTION 2502809

[12] M. Hammad, A. Maher, K. Wang, F. Jiang, and M. Amrani, “Detection


[36] X. Xu, S. Jeong, and J. Li, “Interpretation of electrocardiogram
of abnormal heart conditions based on characteristics of ECG signals,”
(ECG) rhythm by combined CNN and BiLSTM,” IEEE Access, vol. 8,
Measurement, vol. 125, pp. 634–644, Sep. 2018.
pp. 125380–125388, 2020.
[13] G. Garcia, G. Moreira, E. Luz, and D. Menotti, “Improving automatic
cardiac arrhythmia classification: Joining temporal-VCG, complex net-
works and SVM classifier,” in Proc. Int. Joint Conf. Neural Netw.
(IJCNN), Jul. 2016, pp. 3896–3900.
[14] T. Tuncer, S. Dogan, P. Pàawiak, and U. Rajendra Acharya, Mohamed Hammad received the M.Sc. degree from the Information Tech-
“Automated arrhythmia detection using novel hexadecimal local pattern nology Department, Faculty of Computers and Information, Menoufia
and multi- level wavelet transform with ECG signals,” Knowl.-Based Univer- sity, Shebeen El-Kom, Egypt, in 2015, and the Ph.D. degree from the
Syst., vol. 186, Dec. 2019, Art. no. 104923. School of Computer Science and Technology, Harbin Institute of Technology,
[15] J. Zhang, A. Liu, M. Gao, X. Chen, X. Zhang, and X. Chen, “ECG- Harbin, China, in 2019.
based multi-class arrhythmia detection using spatio-temporal attention- He is currently an Assistant Professor with the Faculty of Computers and
based convolutional recurrent neural network,” Artif. Intell. Med., vol. Information, Menoufia University. His research interests include computer
106, Jun. 2020, Art. no. 101856. vision, machine learning, pattern recognition, and biometrics.
[16] S. Nurmaini et al., “An automated ECG beat classification system using
deep neural networks with an unsupervised feature extraction
technique,” Appl. Sci., vol. 9, no. 14, p. 2921, Jul. 2019.
[17] U. R. Acharya et al., “A deep convolutional neural network model Abdullah M. Iliyasu (aka Abdul M. Elias) (Senior Member, IEEE) received
to classify heartbeats,” Comput. Biol. Med., vol. 89, pp. 389–396, the M.E., Ph.D., and Dr.Eng. degrees in computational intelligence and
Oct. 2017. intelligent systems engineering from the Tokyo Institute of Technology
[18] M. Amrani, M. Hammad, F. Jiang, K. Wang, and A. Amrani, “Very (Tokyo Tech.), Tokyo, Japan.
deep feature extraction and fusion for arrhythmias detectionv,” Neural Concurrently, he is a Research Faculty with the School of Computing,
Comput. Appl., vol. 30, no. 7, pp. 2047–2057, 2018. Tokyo Tech and also the Principal Investigator and the Team Leader of the
Advanced Computational Intelligence and Intelligent Systems Engineering
[19] A. Sedik et al., “Deploying machine and deep learning models for
(ACIISE) Research Group, College of Engineering, Prince Sattam Bin Abdu-
efficient data augmented detection of COVID-19 infections,” Viruses,
laziz University (PSAU), Saudi Arabia. He is also a Professor with the School
vol. 12, no. 7, p. 769, 2020.
of Computer Science and Technology, Changchun University of Science and
[20] A. Alghamdi et al., “Detection of myocardial infarction based on novel
Technology, China. In addition to being among the pioneers of research in the
deep transfer learning methods for urban healthcare in smart cities,” emerging quantum image processing (QIP) subdiscipline, he has to his credit
Multimedia Tools Appl., vol. 2020, pp. 1–22, Mar. 2020. more than 120 publications traversing the areas of computational intelligence,
[21] A. Goldberger, L. Amaral, and L. Glass “Physiobank, physiotoolkit, quantum cybernetics, quantum image processing, quantum machine learning,
and physionet: Components of a new research resource for complex cyber and information security, hybrid intelligent systems, the Internet of
physiologic signals,” Circulation, vol. 101, no. 23, p. E215, 2000. Things, 4IR, health informatics, and electronics systems reliability. He is
[22] A. Y. Hannun et al., “Cardiologist-level arrhythmia detection and classi- the Managing Editor of Fuji Technology Press, Japan. He is a member of
fication in ambulatory electrocardiograms using a deep neural network,” editorial board many journals including Journal of Advanced Computational
Nature Med., vol. 25, no. 1, pp. 65–69, Jan. 2019. Intelligence and Intelligent Informatics (JACIII), Quantum Reports Journal,
[23] S. Kiranyaz, O. Avci, O. Abdeljaber, T. Ince, M. Gabbouj, and International Journal of Electrical and Computer Engineering (IJECE), and
D. J. Inman, “1D convolutional neural networks and applications: the Journal of Medical Imaging and Health Informatics (JMIHI). He is
A survey,” 2019, arXiv:1905.03554. [Online]. Available: http://arxiv. also an Associate Editor in many other journals, including IEEE ACCESS,
org/abs/1905.03554 Telekomnika, and Information Sciences.
[24] D. Whitley, “A genetic algorithm tutorial,” Statist. Comput., vol. 4, no.
2, pp. 65–85, 1994.
[25] D. P. Rini, S. M. Shamsuddin, and S. S. Yuhaniz, “Particle swarm
optimization: Technique, system and challenges,” Int. J. Comput. Appl., Abdulhamit Subasi has been a Professor of medical engineering with the
vol. 14, no. 1, pp. 19–26, 2011. University of Turku, Turku, Finland, since 2020. He is specialized in machine
[26] C. L. Huang and C. J. Wang, “A GA-based feature selection and learning, data mining, and biomedical signal processing. Concerning the
parameters optimization for support vector machines,” Expert Syst. appli- cation of machine learning to different fields, he wrote seven book
Appl., vol. 31, no. 2, pp. 231–240, 2006. chapters and more than 170 published journal articles and conference papers.
[27] S. K. Berkaya, A. K. Uysal, E. S. Gunal, S. Ergin, S. Gunal, and He is also the author of the books: Practical Guide for Biomedical Signals
M. B. Gulmezoglu, “A survey on ECG analysis,” Biomed. Signal Analysis Using Machine Learning Techniques and Practical Machine
Process. Control, vol. 43, pp. 216–235, May 2018. Learning for Data Analysis Using Python. He has worked on several projects
[28] M. Hammad, P. Päawiak, K. Wang, and U. R. Acharya, “ResNet– related to biomedical signal processing and data analysis.
attention model for human authentication using ECG signals,” Expert
Syst., vol. 10, Mar. 2020, Art. no. e12547.
[29] M. Hammad and K. Wang, “Fingerprint classification based on a Q-
Gaussian multiclass support vector machine,” in Proc. Int. Conf. Edmond S. L. Ho received the B.Sc. degree in computer science from
Biometrics Eng. Appl. (ICBEA), 2017, pp. 39–44. Hong Kong Baptist University, Hong Kong, in 2003, and the M.Phil. degree
[30] M. T. Hagan and M. B. Menhaj, “Training feedforward networks with in computer science and the Ph.D. degree in informatics from The University
the Marquardt algorithm,” IEEE Trans. Neural Netw., vol. 5, no. 6, of Edinburgh, Edinburgh, U.K., in 2006 and 2011, respectively.
pp. 989–993, 1994. He is currently a Senior Lecturer with the Department of Computer
[31] R. Duda, P. Hart, and D. Stork, Pattern Classification, 2nd ed. and Information Sciences, Northumbria University, Newcastle upon Tyne,
New York, NY, USA: Wiley, 2001, pp. 55–88. U.K. His current research interests include computer graphics and animation,
[32] F. Liu, C. Liu, and L. Zhao, “An open access database for evaluating the computer vision, machine learning, and robotics.
algorithms of electrocardiogram rhythm and morphology abnormality
detection,” J. Med. Imag. Health Inf., vol. 8, no. 7, pp. 1368–1373,
2018.
[33] ANSI/AAMI EC57: 2012-Testing and Reporting Performance Results of Ahmed A. Abd El-Latif received the B.Sc. degree (Hons.) in mathematics
Cardiac Rhythm and ST Segment Measurement Algorithms, Association and computer science and the M.Sc. degree in computer science from
for the Advancement of Medical Instrumentation, Arlington, VA, USA, Menoufia University, Shebeen El-Kom, Egypt, in 2005 and 2010, respectively.
2013. He is currently an Associate Professor of computer science with Menoufia
[34] J. Pan and W. J. Tompkins, “A real-time QRS detection algorithm,” IEEE University, Egypt. He is the author or a coauthor of more than 130 ISI articles.
Trans. Biomed. Eng., vols. BME–32, no. 3, pp. 230–236, Mar. 1985. His areas of interests are multimedia content encryption, secure wireless
[35] R. Li, X. Zhang, H. Dai, B. Zhou, and Z. Wang, “Interpretability communication, IoT, applied cryptanalysis, perceptual cryptography, secret
analysis of heartbeat classification based on heartbeat activity’s global media sharing, information hiding, biometrics, forensic analysis in digital
sequence features and BiLSTM-attention neural network,” IEEE Access, images, and quantum information processing.
vol. 7, pp. 109870–109883, 2019. Dr. Abd El-Latif is also an Associate Editor of the Journal of Cyber
Security and Mobility.

Authorized licensed use limited to: VTU Consortium. Downloaded on March 09,2024 at 04:40:48 UTC from IEEE Xplore. Restrictions apply.

You might also like