Next Article in Journal
A Neurophysiological Evaluation of Cognitive Load during Augmented Reality Interactions in Various Industrial Maintenance and Assembly Tasks
Next Article in Special Issue
Prototype of Monitoring Transportation Pollution Spikes through the Internet of Things Edge Networks
Previous Article in Journal
A New Strategy for Bearing Health Assessment with a Dynamic Interval Prediction Model
Previous Article in Special Issue
Microservice Application Scheduling in Multi-Tiered Fog-Computing-Enabled IoT
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT

1
Department of Computer Science, University of Engineering & Technology, Mardan 23200, Pakistan
2
Department of Computer Science, College of Computer and Information Sciences, King Saud University, P.O. Box 51178, Riyadh 11543, Saudi Arabia
3
Department of Information and Communication Engineering, Yeungnam University, Gyeongsan 38541, Republic of Korea
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(18), 7697; https://doi.org/10.3390/s23187697
Submission received: 3 August 2023 / Revised: 2 September 2023 / Accepted: 4 September 2023 / Published: 6 September 2023
(This article belongs to the Special Issue Internet of Things and Emerging Technologies for Smart Environments)

Abstract

:
Cardiac disorders are a leading cause of global casualties, emphasizing the need for the initial diagnosis and prevention of cardiovascular diseases (CVDs). Electrocardiogram (ECG) procedures are highly recommended as they provide crucial cardiology information. Telemedicine offers an opportunity to provide low-cost tools and widespread availability for CVD management. In this research, we proposed an IoT-based monitoring and detection system for cardiac patients, employing a two-stage approach. In the initial stage, we used a routing protocol that combines routing by energy and link quality (REL) with dynamic source routing (DSR) to efficiently collect data on an IoT healthcare platform. The second stage involves the classification of ECG images using hybrid-based deep features. Our classification system utilizes the “ECG Images dataset of Cardiac Patients”, comprising 12-lead ECG images with four distinct categories: abnormal heartbeat, myocardial infarction (MI), previous history of MI, and normal ECG. For feature extraction, we employed a lightweight CNN, which automatically extracts relevant ECG features. These features were further optimized through an attention module, which is the method’s main focus. The model achieved a remarkable accuracy of 98.39%. Our findings suggest that this system can effectively aid in the identification of cardiac disorders. The proposed approach combines IoT, deep learning, and efficient routing protocols, showcasing its potential for improving CVD diagnosis and management.

1. Introduction

CVD is the leading chronic disease, according to the report of WHO (World Health Organization) [1]. Similarly, Centers for Disease Control and Prevention (CDC) reported that approximately 690,882 deaths occurred in the United States due to heart disease in 2020 [2]. However, CVD can be significantly diminished through early-stage and accurate diagnosis. In the modern world, advanced medical science has unveiled effective solutions for managing CVD problems, harnessing the power of information technology to handle diseases. The tools that are advised for cardiac diagnosis are ECG, Echo, ETT, blood testing, and angiography screening. Among these, ECG is the cheapest and most common diagnostic procedure of screening for heart disorders [3]. Furthermore, it is considered a standard tool for evaluating CVD in patients who live in remote areas. ECG is a non-stationary graphical signal used to detect the electrical movement of the heart by placing electrodes on the surface of the body. The graphical representation of normal ECG is demonstrated in Figure 1.
ECG signifies the probability of cardiac irregularities in their ST segments: usually, the elevations in ST segments, variations in segments, or flipping of T waves indicate some cardiac abnormalities [5].
The IoT refers to the interconnections of an assortment of smart devices, including mobile phones, laptops, and sensors [6,7,8,9]. One of the most compelling areas of application for the IoT is in the field of healthcare. The potential of the IoT has led to the development of various applications, such as remote health monitoring, fitness programs, elderly care, and the management of chronic ailments [10,11,12]. As a result, numerous medical devices, including diagnostic tools, imaging systems, and sensors, have transitioned into smart devices that serve as the foundation of the IoT. By utilizing IoT-based healthcare services, it is possible to reduce costs and improve user experience and quality of life.
Recently, applications for deep learning have been found in diagnosis and prediction across various domains [7,13,14]. Furthermore, deep learning methods notably impact classification accuracy in numerous medical tasks [15,16]. The utilization of deep neural networks (DNNs) in modern computer-aided diagnosis (CAD) systems holds the potential to reduce the efforts required for heart monitoring and improve predictive capabilities. Integrating wearable ECG monitoring systems with deep learning could further enhance the reliability of CAD systems for cardiac patients. Therefore, the IoT-based ECG monitoring system could help reduce diagnostic time and provide healthcare facilities at patients’ doorsteps.
Nevertheless, the automatic detection of heart disorders through ECG-based is faced with several important challenges, such as:
  • the properties of ECG signals that, in terms of amplitude, period, etc., vary from individual to individual due to different demographic factors such as gender, age, lifestyle, etc.;
  • the ECG signals of a single tested person vary across different states, such as sleeping, running, and walking;
  • the noise and artifacts in the captured ECG can lead to variations and differences, as explained in the following subsection.

Artifacts/Noises Affecting the ECG

The ECG signal can become mixed up with different types of unwanted sounds, each with its own characteristics.
  • Baseline wander: This occurs when the signal changes slowly because of things like skin contact or patient movement. It adds a slow-moving section to the ECG signal that we do not want [17].
  • Power line interference: This kind of noise is caused by electricity sources like power lines. It tends to show up at 50 or 60 Hz, even though we cannot always know when it will appear or how strong it will be [18].
  • Motion artifacts: If the sensors move away from where they should be on the skin, it results in these unwanted changes in the signal. These represent a problem because we cannot predict how they will look or how often they will occur.
  • Muscle noise: This occurs because of muscle movements and is similar to the ECG signal in terms of its energy.
To ensure consistency and accuracy in the ECG readings, it is crucial for all clinical technicians to follow the same standardized method for obtaining a 12-lead ECG. This standardization guarantees that the ECG data collected are reliable and precise. These high-quality ECG data then serve as the foundation for feeding into AI-based systems.
The AI-based system capitalizes on these reliable ECG data to carry out the analysis. Employing advanced algorithms, the system can recognize patterns, anomalies, and indicators within the ECG signals. This analysis yields valuable insights that can assist in diagnosing cardiac conditions and making informed medical decisions.

2. Literature Review

Digital image processing and machine learning have a significant role in healthcare. Recently, research has been concentrated on cardiac disease detection through deep learning, yielding promising results [19,20,21,22,23]. CNN is the latest method used for the classification and detection of heart signals with different variations [24,25]. Similarly, Xia et al. [26] recommended a wearable ECG detection system. The model was evaluated through ECG data acquired from a wearable patient monitoring (WPM) device and the MIT-BIH arrhythmia database. Although the authors present good classification performance, the WMP devices face accuracy, precision, and reliability issues [27]. Huang et al. [28] proposed the classification of an ECG arrhythmia using two-dimensional (2D) CNN. In this technique, the five different types of heartbeats were first converted into time–frequency spectrograms before 2D CNN was used to classify the data. The authors presented various approaches in [29], where the main focus was the application of a deep learning model with GRU (gated recurrent unit) and then the use of an ELM (extreme learning machine) for the identification of the ECG signal. Lu et al. [30] used PQRST and 2D convolutional features for the recognition of a single heartbeat, a method called the random oversampling algorithm was used to balance the data, and finally, a random forest classifier was applied. Ji et al. [31] used 1D ECG signals and transformed them into a 2D image. A faster R-CNN (faster regions with a CNN) algorithm was used for the experiment and accomplished an accuracy of 99.21%. Fan et al. [32] used a multiscaled fusion of deep CNN using a single lead short ECG and achieved an accuracy of 96.99%. Li et al. [33] suggested an e-health monitoring system of CVD by combining heartbeats into a two-dimensional feature vector and then applied CNN for efficient detection. In a research work by Naz et al. [34], deep learning techniques were proposed for the detection of cardiac disorders in ECG signals. The signals were transformed into images and then supplied into three different deep learning models: AlexNet, Inception-v3, and VGG-16. Transfer learning was applied to train all these models in the task of detecting CVD. The extracted features were combined, and the best ones were selected through a heuristic entropy method.
As most researchers used timeseries data of ECG with signal leads, which are not suitable for power line interface and muscle contraction, among other things. The most appropriate method for screening cardiac disorders usually advised by cardiologists is the use of 12-lead ECG images. The major motivation and contribution of this paper is the development of an effective automated CVD system using 12-lead ECG images for hospitals as well as for remote patients. In this work, we applied a lightweight CNN with attention module, while the results are evaluated using an accuracy, recall, precision, and confusion matrix.
The above review is summarized in Table 1.
The subsequent sections of this manuscript are organized as follows: Section 3 delineates the proposed methodology encompassing the IoT-based framework and the automated classification of ECG images. This approach involves the use of REL and DSR routing for data transformation, as well as the application of the lightweight CNN for classification. In Section 4, the results and discussion are given, and finally, the conclusions and future research directions are outlined in Section 5.

3. Proposed Method

The proposed system is implemented in a two-stage approach, i.e., IoT-based ECG framework and the classification of ECG images.

3.1. IoT-Based ECG Framework

The system described primarily consists of three components: an electrocardiogram (ECG) sensing system, an internet of things (IoT) cloud, and a graphical user interface (GUI), as presented in Figure 2. The ECG sensing system often utilizes wearable sensors for continuous monitoring, which have minimal disruption to a user’s daily life. These sensors allow for the long-term recording of ECG data.
As presented in Figure 2, the IoT cloud system is composed of three main components: collection of data and transmission, ECG investigation, and disease alert. The data collection module involves the use of portable devices to collect ECG data, which are then transmitted to the cloud using a routing protocol. REL and DSR routing were employed for data transformation. The ECG analysis module is liable for extracting essential features for the identification of potential heart diseases. However, the ECG signals may be affected by noise in the data collection and communication process, which can impact the accuracy of the diagnosis. Consequently, the IoT cloud also presents data analysis architecture to extract relevant features using the ECG signals. Finally, the disease alert module is critical for protecting patients and providing an alert system to ease medical care when needed.

3.1.1. DSR Protocol

The DSR protocol operates as a source-routing mechanism within the IoT cloud network, enabling the transmission of packets across multiple hops among network nodes. This is particularly useful when the distance between nodes exceeds the range of direct transmission. The protocol involves the initiation of a packet’s transmission via an originator node, which determines a specific sequence of nodes through which the packet must pass to reach its intended destination.
In the DSR protocol, when a source node (S) seeks to transmit data to a destination node (D), it first checks its route cache to determine whether a direct route to D exists. If such a route is absent, S broadcasts a route demand message to its neighboring nodes. These neighboring nodes, acting as intermediaries, either respond with route information through a route reply message if they possess a suitable route to D or they forward the request to their own neighboring nodes [35].
This iterative process continues until the route demand message reaches either D or a node that holds a viable route to D. Upon receiving a route reply message, S stores the route information in its cache, enabling subsequent data transmission along the established route.
It is important to note that the DSR protocol prioritizes route discovery only when there are data to be sent to a destination. Each node maintains a list of routes in its cache, and a node will request a route from its neighbors if it lacks a route to a specific location. The protocol’s core mechanisms include route discovery and maintenance, and while it offers simplicity and efficiency, it has limitations in handling large networks and susceptibility to specific types of routing loops and attacks.
Due to its characteristics, the DSR protocol is most effective in small-scale, ad hoc networks, where minimizing overhead takes precedence over scalability and robustness. The operation of the DSR protocol is summarized in Figure 3, outlining the steps from route discovery to successful data transmission, with additional nodes identified alongside the source node (S) and destination node (D) for clarity.
  • The source node (S) intends to transmit data to the destination node (D).
  • S verifies its route cache to determine the availability of a route to D.
  • If S does not possess a route to D in its cache, it broadcasts a route demand message to its neighboring nodes.
  • Each neighbor that receives the route request message checks its own route cache to see whether it has a route to D. If it does, it sends a route reply message back to S with the route information. If it does not have a route to D, it forwards the request to its own neighbors.
  • This procedure carries on until the request is received by either D or a node with a route to D.
  • When a route reply message is received by S, it records the route in its cache and uses it to send the data to D.

3.1.2. REL Protocol

REL protocol is commonly used in wireless sensor networks (WSNs) and IoT applications such as smart cities, environmental monitoring, healthcare, and comfortable offices and homes. It uses residual energy and link quality to find routes that improve the system’s QoS (quality of service) reliability and support and incorporates an event-driven mechanism for load balancing and the prevention of early node death [36]. In WSN communication, links are often unreliable due to low-powered radios that are vulnerable to multipath distortion, noise, and interference. The effectiveness of route selection depends on the accuracy of the link quality estimate to improve reliability. Generally, a LQE (single link quality estimator) value such as LQI (link quality indicator) or RSSI (received signal strength indicator) is used to represent the link quality at a specific time, but it does not provide additional information about the end-to-end link quality, hop count, or residual energy.
The REL protocol has a number of advantages over purely reactive protocols like DSR. It has lower latency and overheads, since routes are maintained proactively rather than being discovered on an as-needed basis. It also has better scalability, since it can handle larger networks more efficiently. However, it does have some drawbacks, such as higher energy consumption and the potential for routing loops if the proactive flooding mechanism is not implemented carefully.
Thus, a hybrid approach of routing protocol is used, which combines elements of both DSR and REL. The hybrid protocol uses a REL to maintain routes to commonly used destinations, while using a DSR to discover routes to less frequently-used destinations on an as-needed basis.

3.2. Classification of ECG Images

A typical ECG consists of P and T waves, PR and ST segments, PR and QT intervals, as well as the QRS complex. The dataset employed in this work consisted of 12-lead ECG images and is publicly available [37]. All these features have been considered using the lightweight CNN model to ensure that it is equipped with the necessary information to accurately classify ECG signals into their respective categories. The details of the proposed methodology are shown in Figure 4.

3.2.1. Dataset

We utilized a publicly accessible dataset in this study known as the “ECG Images dataset of Cardiac Patients” [37]. This dataset comprises 12-lead ECG images categorized into four groups: normal, myocardial infarction (MI), abnormal heartbeat, and previous history of MI. The detailed description of the 12-lead ECG Images dataset used in the proposed model is provided in Table 2, while the distribution of images within the dataset is illustrated in Figure 5.
To provide a clearer description of the dataset, we have chosen random sample from abnormal heartbeat and myocardial infarction (MI), as illustrated in Figure 6.

3.2.2. Lightweight CNN

The proposed lightweight CNN consists of several components, as depicted in Figure 7.

Four-Layer Lightweight CNN

The initial component of the model is responsible for processing the input ECG data and extracting appropriate features from it. This lightweight CNN usually includes multiple convolutional layers, as well as pooling layers and activation functions. The purpose of the four-layer CNN is to effectively capture important patterns from the ECG data. The proposed lightweight CNN is employed to automatically extract ECG features. This CNN focuses on feature extraction and leaves feature optimization to the attention module, which is the method’s main focus. Additionally, the inclusion of a BatchNormalization (BN) layer and a ReLU layer in the CNN helps to improve the training process and avoid overfitting.

Attention Module

The attention module is a crucial component of the proposed method that enhances the characteristics appropriate to the identification category. This module is based on two primary strategies.
The contextual encoding layer: This method enables the model to discover contextual connections between various input data [38], which is helpful for identifying dependencies in sequences. By understanding contextual relationships, the model can better capture dependencies and patterns in the ECG data.
The depthwise separable convolution: This method is used to reduce the model’s number of parameters. A lighter model with fewer parameters is produced via depthwise separable convolution, which separates the spatial and channel-wise processes [39]. This makes the model more effective for use in practical applications.

Flattening and SoftMax Classifier

The improved features are flattened into a one-dimensional vector after going through the attention module, turning the 2D or 3D tensor into a linear array. The SoftMax classifier is then fed this one-dimensional vector. A common option for multi-class classification tasks is the SoftMax classifier, which determines the probability of each identity category based on the ECG data retrieved by the preceding layers. The input ECG sequence’s anticipated identity is the class with the highest probability.
When an ECG image is input, the model goes through three stages of the lightweight CNN model to produce a label for the image based on the identified features. The model was trained using specific parameters listed in Table 3. The loss function employed for the model is categorical cross entropy, a common choice for multiclass classification tasks. The rate of learning is set at 0.001, determining the step size of the optimizer during training. The model employs the Adam optimizer, a widely used optimization algorithm that updates model weights based on the gradient of the loss function. The training process spans 70 epochs, indicating that the complete dataset passes through the model 70 times. The dataset is divided into training and testing sets of 80% and 20%, respectively. The batch size used is 16, meaning that 16 samples are utilized to adjust model weights in each iteration of training. Finally, the activation function in the output layer is SoftMax, a standard choice for obtaining the probability distribution of expected classes in multiclass classification tasks.
The pseudo-code of the proposed system, focusing on the IoT-based ECG framework and the classification of ECG images, is described below:
  • IoT-based ECG Framework
    • Initialization:
      • Initialize ECG sensing system (wearable sensors) for continuous monitoring.
      • Initialize IoT cloud for data collection, transmission, analysis, and disease alert.
    • Data Collection and Transmission:
      • Read ECG data from wearable sensors continuously.
      • Send the collected ECG data to the IoT cloud using DSR or REL routing protocol.
    • ECG Investigation:
      • IoT cloud receives the ECG data and stores them.
      • IoT cloud performs data analysis to achieve essential features using the ECG signals.
    • Disease Alert:
      • IoT cloud processes the extracted features and detects potential heart diseases.
      • If a potential heart disease is detected, the disease alert module is triggered.
      • The disease alert module sends alerts to relevant parties (medical personnel, patients) for immediate medical care.
    • Route Discovery (DSR Protocol):
      • When a source node (S) wants to send data to a destination node (D) and does not have a route in its cache:
      • S broadcasts a route request message to its neighboring nodes.
      • Each neighbor receiving the request checks its own cache for a route to D.
      • If a route is found, the neighbor sends a route reply message back to S with the route information.
      • If no route is found, the neighbor forwards the request to its own neighbors.
    • Route Maintenance (DSR Protocol):
      • When a route reply message is received by S, it records the route in its cache for future use.
      • The route is also saved in the route caches of all nodes that helped find it.
    • Route Selection (REL protocol):
      • REL protocol uses residual energy and link quality to find routes for improved QoS reliability.
      • Links are selected based on LQE values (e.g., LQI, RSSI) and residual energy.
  • Classification of ECG Images
    h.
    Dataset Preparation:
    • Load the “ECG Images dataset of Cardiac Patients”, consisting of 12-lead-based ECG images and four classes (normal, myocardial infarction, previous history of MI, abnormal heartbeat).
    • Split the dataset.
    i.
    Lightweight CNN Model:
    • Input layer for processing the ECG data.
    • Multiple convolutional layers with pooling and activation functions to capture important patterns.
    • Contextual encoding layer: discover contextual connections in input data for identifying dependencies in sequences.
    • Depthwise separable convolution: reduce model parameters for efficiency.
    • Flattening: flatten the improved features into a one-dimensional vector.
    • SoftMax classifier: determine the probability of each identity category based on the extracted ECG data.

4. Experimentation

4.1. Performance Matrices

The performance of the model employed in the work was evaluated using various metrics, including the accuracy, precision, recall, and confusion matrix [40,41,42].
  • Accuracy measures the proportion of correct predictions made by the model.
  • Sensitivity or recall is the measure to predict true positives out of all positive
  • instances.
  • Precision is a measure of the ability to predict true positives from actual positive instances.
  • The confusion matrix is a table that summarizes the presentation of a classifier by comparing the actual and predicted classifications.
The aim of the research was to classify various types of cardiac disorders, and the outcomes of this classification are reported in Table 4. These evaluations were carried out in order to determine how well the models were able to correctly classify the different disorders.
To classify ECG images, the following terms are used to evaluate the parameters: T + signifies true positive, F + is false positive, T is true negative, and F signifies false negative. The formulas of accuracy, recall, and precision are obtained based on Table 4, and are given as Equations (1)–(3).
Accuracy = T + + T T + + F + F + + T
Sensitivity   or   Recall = T + T + + F
Precision = T + T + + F +

4.2. Results and Discussion

The description of the lightweight model’s parameters is depicted in Table 5. The Table provides a comprehensive summary of the model’s architecture, including the number of float operations and the input shape for each layer.
The proposed lightweight CNN model has achieved an impressive accuracy with the possibility of further enhancement through the fine-tuning of hyper-parameters. The results in Table 6 display the performance of the model. The accuracy, which is 98.39%, represents the portion of correct predictions. Precision, given as 0.985, indicates that about 98.5% of the positive predictions made by the model were accurate. Recall, at 0.98, signifies that the model identified around 98% of all actual positive cases.
The results are presented graphically in Figure 8, illustrating the loss and accuracy trends across each epoch during the training phase. The graph distinctly illustrates that the model’s accuracy improved with the progression of training epochs. This outcome gains further validation through the utilization of a confusion matrix (Figure 9). This matrix offers a concise overview of how well the model performed in terms of its projected and actual classifications. Notably, it is important to mention that the confusion matrix displayed in Figure 9 is derived exclusively from the test data, constituting 20% of the total dataset.
Clearly, these results show that the model’s ability to comprehend hierarchical features from a limited dataset underscores its potential to capture intricate patterns and representations within the data, resulting in enhanced performance in tasks characterized by data scarcity. Furthermore, its deliberate design prioritizes computational efficiency, distinguishing it from deeper and more intricate CNN architectures. This efficiency renders the lightweight CNN particularly suitable for resource-constrained scenarios, such as IoT devices and wearable sensors, where computational resources may be restricted. The advantage of a lightweight CNN lies in its automatic feature learning capability from the raw ECG data. By directly capturing abstract patterns and representations from the data, it enhances the potential for better discrimination between different classes. This feature extraction process removes the requirement for manual feature engineering, simplifying the model’s architecture, and contributing to its overall interpretability.
This manuscript discusses an IoT-based cardiac patient monitoring and detection system, which, by design, involves real-time data collection from IoT sensors. However, to demonstrate the model’s effectiveness, we initially used a publicly available ECG image dataset, widely accepted as a benchmark in the field. This dataset served as an initial testbed, and its results are presented in Figure 10, where an input image is successfully predicted. We specifically worked with a dataset consisting of 12-lead cardiac ECG images recorded at a 500 Hz frequency. However, we acknowledge that ECG images can significantly vary across different sources and clinical settings. To ensure our model’s robustness and applicability to a wider range of datasets, including real-world data, extensive training is necessary.
Finally, Table 7 presents a comparison between the outcomes of our proposed method and the models that use the same dataset for classifying ECG images. Through an extensive search, we found that the only existing studies utilizing the same dataset for classifying the four classes are [5,43]. Our proposed lightweight CNN method has clearly demonstrated its excellence by achieving superior accuracy and precision, thereby establishing its effectiveness in ECG image classification.

5. Conclusions and Future Work

This paper presents a solution aimed at enhancing the management of a CVD through early diagnosis. Despite the advancements in clinical treatment, the accurate detection of cardiac disorders remains a challenging task. Deep learning has emerged as a promising approach to improve diagnosis, especially in remote patient scenarios, achieving an impressive accuracy of 98.39%. However, a limitation of this research is the absence of the segmentation process, which could have increased computational complexity and further improved the results.
Incorporating the segmentation approach before classification is the work’s future goal because it is anticipated to improve the diagnostic process’ accuracy and dependability. The suggested solution intends to further improve and streamline the CVD detection process by utilizing robust features and investigating alternative deep learning models on more datasets. These initiatives could change early detection and open the door to the better management of heart diseases.

Author Contributions

Conceptualization, T.S. and M.S.; methodology, T.S.; software, S.A.; validation, I.K., R.K. and I.A.; formal analysis, S.A.; investigation and resources, I.A. and R.K.; data curation, S.A.; writing—original draft preparation, T.S.; writing—review and editing, T.S.; visualization, I.A.; supervision, M.S.; project administration, M.S. and S.A.; funding acquisition, M.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research is funded by the Researchers Supporting Project Number (RSPD2023R1027), King Saud University, Riyadh, Saudi Arabia.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The dataset used in this research is available online at https://data.mendeley.com/datasets/gwbz3fsgp8/2 (accessed on 20 July 2023).

Acknowledgments

The authors extend their appreciation to King Saud University for funding this research through Researchers Supporting Project Number (RSPD2023R1027), King Saud University, Riyadh, Saudi Arabia.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hindia, M.N.; Rahman, T.A.; Ojukwu, H.; Hanafi, E.B.; Fattouh, A. Enabling Remote Health-Caring Utilizing IoT Concept over LTE-Femtocell Networks. PLoS ONE 2016, 11, e0155077. [Google Scholar] [CrossRef] [PubMed]
  2. Ahmad, F.B.; Anderson, R.N. The Leading Causes of Death in the US for 2020. JAMA-J. Am. Med. Assoc. 2021, 325, 1829–1830. [Google Scholar] [CrossRef]
  3. Wang, L.; Zhang, H.; Wong, K.C.L.; Liu, H.; Shi, P. Physiological-Model-Constrained Noninvasive Reconstruction of Volumetric Myocardial Transmembrane Potentials. IEEE Trans. Biomed. Eng. 2009, 57, 296–315. [Google Scholar] [CrossRef] [PubMed]
  4. Zheng, J.; Zhang, J.; Danioko, S.; Yao, H.; Guo, H.; Rakovski, C. A 12-lead electrocardiogram database for arrhythmia research covering more than 10,000 patients. Sci. Data 2020, 7, 48. [Google Scholar] [CrossRef] [PubMed]
  5. Khan, A.H.; Hussain, M.; Malik, M.K. Cardiac Disorder Classification by Electrocardiogram Sensing Using Deep Neural Network. Complexity 2021, 2021, 5512243. [Google Scholar] [CrossRef]
  6. Ghaffar, Z.; Alshahrani, A.; Fayaz, M.; Alghamdi, A.M.; Gwak, J. A Topical Review on Machine Learning, Software Defined Networking, Internet of Things Applications: Research Limitations and Challenges. Electronics 2021, 10, 880. [Google Scholar]
  7. Hassan, R.; Qamar, F.; Hasan, M.K.; Aman, A.H.M.; Ahmed, A.S. Internet of Things and Its Applications: A Comprehensive Survey. Symmetry 2020, 12, 1674. [Google Scholar] [CrossRef]
  8. Imran; Iqbal, N.; Kim, D.H. IoT Task Management Mechanism Based on Predictive Optimization for Efficient Energy Consumption in Smart Residential Buildings. Energy Build. 2022, 257, 111762. [Google Scholar] [CrossRef]
  9. Imran; Ahmad, S.; Kim, D.H. A Task Orchestration Approach for Efficient Mountain Fire Detection Based on Microservice and Predictive Analysis in IoT Environment. J. Intell. Fuzzy Syst. 2021, 40, 5681–5696. [Google Scholar] [CrossRef]
  10. Imran; Iqbal, N.; Ahmad, S.; Kim, D.H. Health Monitoring System for Elderly Patients Using Intelligent Task Mapping Mechanism in Closed Loop Healthcare Environment. Symmetry 2021, 13, 357. [Google Scholar] [CrossRef]
  11. Rani, A.A.V.; Baburaj, E. Secure and Intelligent Architecture for Cloud-Based Healthcare Applications in Wireless Body Sensor Networks. Int. J. Biomed. Eng. Technol. 2019, 29, 186–199. [Google Scholar] [CrossRef]
  12. Zaman, U.; Imran; Mehmood, F.; Iqbal, N.; Kim, J.; Ibrahim, M. Towards Secure and Intelligent Internet of Health Things: A Survey of Enabling Technologies and Applications. Electronics 2022, 11, 1893. [Google Scholar] [CrossRef]
  13. Imran; Qayyum, F.; Kim, D.-H.; Bong, S.-J.; Chi, S.-Y.; Choi, Y.-H. A Survey of Datasets, Preprocessing, Modeling Mechanisms, and Simulation Tools Based on AI for Material Analysis and Discovery. Materials 2022, 15, 1428. [Google Scholar] [CrossRef] [PubMed]
  14. Imran; Iqbal, N.; Kim, D.-H. Intelligent Material Data Preparation Mechanism Based on Ensemble Learning for AI-Based Ceramic Material Analysis. Adv. Theory Simul. 2022, 5, 2200517. [Google Scholar] [CrossRef]
  15. Ebrahimi, Z.; Loni, M.; Daneshtalab, M.; Gharehbaghi, A. A Review on Deep Learning Methods for ECG Arrhythmia Classification. Expert Syst. Appl. X 2020, 7, 100033. [Google Scholar] [CrossRef]
  16. Iqbal, N.; Imran; Ahmad, S.; Ahmad, R.; Kim, D.-H. A Scheduling Mechanism Based on Optimization Using IoT-Tasks Orchestration for Efficient Patient Health Monitoring. Sensors 2021, 21, 5430. [Google Scholar] [CrossRef] [PubMed]
  17. Gupta, P.; Sharma, K.K.; Joshi, D. Baseline wander removal of electrocardiogram signals using multivariate empirical mode decomposition. Healthc. Technol. Lett. 2015, 2, 164–166. [Google Scholar] [CrossRef]
  18. Gaceck, A.; Pedryez, W. (Eds.) ECG Signal Processing, Classification and Interpretation: A Comprehensive Framework of Computational Intelligence; Springer: Berlin/Heidelberg, Germany, 2011. [Google Scholar]
  19. Acharya, U.R.; Fujita, H.; Oh, S.L.; Hagiwara, Y.; Tan, J.H.; Adam, M.; Tan, R.S. Deep Convolutional Neural Network for the Automated Diagnosis of Congestive Heart Failure Using ECG Signals. Appl. Intell. 2019, 49, 16–27. [Google Scholar] [CrossRef]
  20. Andersen, R.S.; Peimankar, A.; Puthusserypady, S. A Deep Learning Approach for Real-Time Detection of Atrial Fibrillation. Expert Syst. Appl. 2019, 115, 465–473. [Google Scholar] [CrossRef]
  21. Chamatidis, I.; Katsika, A.; Spathoulas, G. Using Deep Learning Neural Networks for ECG Based Authentication. In Proceedings of the International Carnahan Conference on Security Technology, Madrid, Spain, 23–26 October 2017; pp. 1–6. [Google Scholar]
  22. Isin, A.; Ozdalili, S. Cardiac Arrhythmia Detection Using Deep Learning. Procedia Comput. Sci. 2017, 120, 268–275. [Google Scholar] [CrossRef]
  23. Limam, M.; Precioso, F. Atrial Fibrillation Detection and ECG Classification Based on Convolutional Recurrent Neural Network. In Proceedings of the Computing in Cardiology, Rennes, France, 24–27 September 2017; Volume 44, pp. 1–4. [Google Scholar]
  24. Xiao, B.; Xu, Y.; Bi, X.; Zhang, J.; Ma, X. Heart Sounds Classification Using a Novel 1-D Convolutional Neural Network with Extremely Low Parameter Consumption. Neurocomputing 2020, 392, 153–159. [Google Scholar] [CrossRef]
  25. Noman, F.; Ting, C.M.; Salleh, S.H.; Ombao, H. Short-Segment Heart Sound Classification Using an Ensemble of Deep Convolutional Neural Networks. In Proceedings of the ICASSP, IEEE International Conference on Acoustics, Speech and Signal Processing-Proceedings, Brighton, UK, 12–17 May 2019; pp. 1318–1322. [Google Scholar]
  26. Xia, Y.; Zhang, H.; Xu, L.; Gao, Z.; Zhang, H.; Liu, H.; Li, S. An Automatic Cardiac Arrhythmia Classification System with Wearable Electrocardiogram. IEEE Access 2018, 6, 16529–16538. [Google Scholar] [CrossRef]
  27. Mahajan, A.; Pottie, G.; Kaiser, W. Transformation in Healthcare by Wearable Devices for Diagnostics and Guidance of Treatment. ACM Trans. Comput. Healthc. 2020, 1, 1–12. [Google Scholar] [CrossRef]
  28. Huang, J.; Chen, B.; Yao, B.; He, W. ECG Arrhythmia Classification Using STFT-Based Spectrogram and Convolutional Neural Network. IEEE Access 2019, 7, 92871–92880. [Google Scholar] [CrossRef]
  29. Virgeniya, S.C.; Ramaraj, E. A Novel Deep Learning Based Gated Recurrent Unit with Extreme Learning Machine for Electrocardiogram (ECG) Signal Recognition. Biomed. Signal Process. Control 2021, 68, 102779. [Google Scholar] [CrossRef]
  30. Lu, W.; Hou, H.; Chu, J. Feature Fusion for Imbalanced ECG Data Analysis. Biomed. Signal Process. Control 2018, 41, 152–160. [Google Scholar] [CrossRef]
  31. Ji, Y.; Zhang, S.; Xiao, W. Electrocardiogram Classification Based on Faster Regions with Convolutional Neural Network. Sensors 2019, 19, 2558. [Google Scholar] [CrossRef] [PubMed]
  32. Fan, X.; Yao, Q.; Cai, Y.; Miao, F.; Sun, F.; Li, Y. Multiscaled Fusion of Deep Convolutional Neural Networks for Screening Atrial Fibrillation from Single Lead Short ECG Recordings. IEEE J. Biomed. Health Inform. 2018, 22, 1744–1753. [Google Scholar] [CrossRef]
  33. Li, J.; Siegrist, J. Physical Activity and Risk of Cardiovascular Disease—A Meta-Analysis of Prospective Cohort Studies. Int. J. Environ. Res. Public Health 2012, 9, 391–407. [Google Scholar] [CrossRef]
  34. Naz, M.; Shah, J.H.; Khan, M.A.; Sharif, M.; Raza, M.; Damaševičius, R. From ECG Signals to Images: A Transformation Based Approach for Deep Learning. PeerJ Comput. Sci. 2021, 7, e386. [Google Scholar] [CrossRef]
  35. Johnson, D.B.; Maltz, D.A.; Broch, J. DSR: The Dynamic Source Routing Protocol for Multi-Hop Wireless Ad Hoc Networks. Ad Hoc Netw. 2001, 5, 139–172. [Google Scholar]
  36. Machado, K.; Rosário, D.; Cerqueira, E.; Loureiro, A.A.F.; Neto, A.; de Souza, J.N. A Routing Protocol Based on Energy and Link Quality for Internet of Things Applications. Sensors 2013, 13, 1942–1964. [Google Scholar] [CrossRef] [PubMed]
  37. Khan, A.H.; Hussain, M. ECG Images Dataset of Cardiac Patients. Mendeley Data, V2. Available online: https://data.mendeley.com/datasets/gwbz3fsgp8/2 (accessed on 20 July 2023).
  38. Zhang, H.; Xue, J.; Dana, K. Deep ten: Texture encoding network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 708–717. [Google Scholar]
  39. Fran, C. Deep learning with depth wise separable convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
  40. Matthews, B.W. Comparison of the Predicted and Observed Secondary Structure of T4 Phage Lysozyme. BBA-Protein Struct. 1975, 405, 442–451. [Google Scholar] [CrossRef]
  41. Sadad, T.; Bukhari, S.A.C.; Munir, A.; Ghani, A.; El-Sherbeeny, A.M.; Rauf, H.T. Detection of Cardiovascular Disease Based on PPG Signals Using Machine Learning with Cloud Computing. Comput. Intell. Neurosci. 2022, 2022, 1672677. [Google Scholar] [CrossRef]
  42. Sadad, T.; Munir, A.; Saba, T.; Hussain, A. Fuzzy C-Means and Region Growing Based Classification of Tumor from Mammograms Using Hybrid Texture Feature. J. Comput. Sci. 2018, 29, 34–45. [Google Scholar] [CrossRef]
  43. Abubaker, M.B.; Babayiğit, B. Detection of cardiovascular diseases in ECG images using machine learning and deep learning methods. IEEE Trans. Artif. Intell. 2022, 4, 373–382. [Google Scholar] [CrossRef]
Figure 1. Illustration of normal ECG [4].
Figure 1. Illustration of normal ECG [4].
Sensors 23 07697 g001
Figure 2. IoT-based ECG framework.
Figure 2. IoT-based ECG framework.
Sensors 23 07697 g002
Figure 3. DSR protocol illustration from S to D.
Figure 3. DSR protocol illustration from S to D.
Sensors 23 07697 g003
Figure 4. Proposed method of ECG classification.
Figure 4. Proposed method of ECG classification.
Sensors 23 07697 g004
Figure 5. ECG data distribution.
Figure 5. ECG data distribution.
Sensors 23 07697 g005
Figure 6. ECG samples.
Figure 6. ECG samples.
Sensors 23 07697 g006
Figure 7. Lightweight CNN.
Figure 7. Lightweight CNN.
Sensors 23 07697 g007
Figure 8. Loss vs. accuracy.
Figure 8. Loss vs. accuracy.
Sensors 23 07697 g008
Figure 9. Confusion matrix.
Figure 9. Confusion matrix.
Sensors 23 07697 g009
Figure 10. (a) Input image of MI. (b) Predicted image as MI.
Figure 10. (a) Input image of MI. (b) Predicted image as MI.
Sensors 23 07697 g010
Table 1. Literature review conclusions.
Table 1. Literature review conclusions.
Research WorkMethodDatasetResults
Imran et al., 2022 [14]Wearable ECG detection systemECG data from wearable patient monitoring device and MIT-BIH arrhythmia databaseClaimed good classification performance
Chamatidis et al., 2017 [21]Faster R-CNN-99.21% accuracy in detecting ECG signals
Isin et al., 2017 [22]Multiscaled fusion of deep CNNSingle lead short ECG96.99% accuracy
Naz et al., 2021 [34]Deep learning techniques (AlexNet, Inception-v3, VGG-16) + transfer learning-Claimed good results
Table 2. Image distributions based on classes.
Table 2. Image distributions based on classes.
S/No.Activities
Normal284
Myocardial infarction (MI)240
Previous history of MI172
Abnormal heartbeat233
Table 3. Proposed parameters for lightweight CNN.
Table 3. Proposed parameters for lightweight CNN.
NameDescription
Batch size16
OptimizerAdam
Training80%
Loss FunctionCategorical cross-entropy
Epochs70
Learning rate0.001
Testing20%
ActivationSoftMax
Table 4. Prediction outcomes.
Table 4. Prediction outcomes.
OutcomeDefinition
T Correct identification of negative data
T + Correct identification of positive data
F Incorrect identification of negative data
F + Incorrect identification of positive data
Table 5. Float operations.
Table 5. Float operations.
LayerFloat OperationsInput Shape
Conv2D7,962,6241, 288, 432, 1
Conv2D7,077,8881, 24, 72, 32
MatMul786,4321, 3072
BiasAdd442,3681, 96, 144, 32
MaxPool442,3681, 96, 144, 32
BiasAdd12,2881, 8, 24, 64
MaxPool12,2881, 8, 24, 64
MatMul10241, 128
BiasAdd1281, 128
SoftMax201, 4
BiasAdd41, 4
All Layers16,737,432
Table 6. Obtained results.
Table 6. Obtained results.
Accuracy (%)PrecisionRecall
98.390.9850.98
Table 7. Comparison with recent techniques.
Table 7. Comparison with recent techniques.
Refs.YearMethodDatasetAccuracy (%)Recall (%)Precision (%)
[5]2021MobileNet v2ECG images for Cardiac patients97.5--
[43]2022CNN 98.2398.2298.31
Proposed-Lightweight CNN98.399898.5
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Sadad, T.; Safran, M.; Khan, I.; Alfarhood, S.; Khan, R.; Ashraf, I. Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT. Sensors 2023, 23, 7697. https://doi.org/10.3390/s23187697

AMA Style

Sadad T, Safran M, Khan I, Alfarhood S, Khan R, Ashraf I. Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT. Sensors. 2023; 23(18):7697. https://doi.org/10.3390/s23187697

Chicago/Turabian Style

Sadad, Tariq, Mejdl Safran, Inayat Khan, Sultan Alfarhood, Razaullah Khan, and Imran Ashraf. 2023. "Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT" Sensors 23, no. 18: 7697. https://doi.org/10.3390/s23187697

APA Style

Sadad, T., Safran, M., Khan, I., Alfarhood, S., Khan, R., & Ashraf, I. (2023). Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT. Sensors, 23(18), 7697. https://doi.org/10.3390/s23187697

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop