Efficient Classification of ECG Images Using a Lightweight CNN with Attention Module and IoT
Abstract
:1. Introduction
- 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
- 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.
2. Literature Review
3. Proposed Method
3.1. IoT-Based ECG Framework
3.1.1. DSR Protocol
- 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
3.2. Classification of ECG Images
3.2.1. Dataset
3.2.2. Lightweight CNN
Four-Layer Lightweight CNN
Attention Module
Flattening and SoftMax Classifier
- 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
- 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.
4.2. Results and Discussion
5. Conclusions and Future Work
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- Gaceck, A.; Pedryez, W. (Eds.) ECG Signal Processing, Classification and Interpretation: A Comprehensive Framework of Computational Intelligence; Springer: Berlin/Heidelberg, Germany, 2011. [Google Scholar]
- 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]
- 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]
- 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]
- Isin, A.; Ozdalili, S. Cardiac Arrhythmia Detection Using Deep Learning. Procedia Comput. Sci. 2017, 120, 268–275. [Google Scholar] [CrossRef]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- Lu, W.; Hou, H.; Chu, J. Feature Fusion for Imbalanced ECG Data Analysis. Biomed. Signal Process. Control 2018, 41, 152–160. [Google Scholar] [CrossRef]
- Ji, Y.; Zhang, S.; Xiao, W. Electrocardiogram Classification Based on Faster Regions with Convolutional Neural Network. Sensors 2019, 19, 2558. [Google Scholar] [CrossRef] [PubMed]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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).
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
Research Work | Method | Dataset | Results |
---|---|---|---|
Imran et al., 2022 [14] | Wearable ECG detection system | ECG data from wearable patient monitoring device and MIT-BIH arrhythmia database | Claimed 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 CNN | Single lead short ECG | 96.99% accuracy |
Naz et al., 2021 [34] | Deep learning techniques (AlexNet, Inception-v3, VGG-16) + transfer learning | - | Claimed good results |
S/No. | Activities |
---|---|
Normal | 284 |
Myocardial infarction (MI) | 240 |
Previous history of MI | 172 |
Abnormal heartbeat | 233 |
Name | Description |
---|---|
Batch size | 16 |
Optimizer | Adam |
Training | 80% |
Loss Function | Categorical cross-entropy |
Epochs | 70 |
Learning rate | 0.001 |
Testing | 20% |
Activation | SoftMax |
Outcome | Definition |
---|---|
Correct identification of negative data | |
Correct identification of positive data | |
Incorrect identification of negative data | |
Incorrect identification of positive data |
Layer | Float Operations | Input Shape |
---|---|---|
Conv2D | 7,962,624 | 1, 288, 432, 1 |
Conv2D | 7,077,888 | 1, 24, 72, 32 |
MatMul | 786,432 | 1, 3072 |
BiasAdd | 442,368 | 1, 96, 144, 32 |
MaxPool | 442,368 | 1, 96, 144, 32 |
BiasAdd | 12,288 | 1, 8, 24, 64 |
MaxPool | 12,288 | 1, 8, 24, 64 |
MatMul | 1024 | 1, 128 |
BiasAdd | 128 | 1, 128 |
SoftMax | 20 | 1, 4 |
BiasAdd | 4 | 1, 4 |
All Layers | 16,737,432 |
Accuracy (%) | Precision | Recall |
---|---|---|
98.39 | 0.985 | 0.98 |
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. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
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
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 StyleSadad, 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 StyleSadad, 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