Artificial Intelligence for Cardiac Diseases Diagnosis and Prediction Using ECG Images on Embedded Systems
Abstract
:1. Introduction
- construction of a deep-learning algorithm model for application to ECG signals;
- detection and classification of abnormal patterns (spectra) on ECG signals; and
- validation and improvement of the predictive model on a new database.
2. Materials and Methods
2.1. Data Used
- Normal: for subjects who do not suffer from any pathology;
- MI: for subjects with a myocardial infarction (MI);
- HMI: for subjects with a history of myocardial infarction (recovered from a MI); and
- ABH: for subjects suffering from cardiac arrhythmias (abnormal heartbeat).
2.2. Preprocessing
- brightness (0.2): brightness adjustment;
- contrast (0.6): contrast adjustment;
- gamma (gamma = 3, gain = 2): control of the overall brightness and the blue-green–red of the image;
- hue (0.9): hue that controls the colors red, yellow, green, and blue;
- saturation (0.2): adjustment of the hue–white light mixture; and
- central-crop (0.92): division of the area of interest.
2.3. Hyper-Parameters Used
- learning rate (0.01);
- dropout (0.1);
- Conv2D filters (min = 64, max = 128, step = 32);
- batch size = 32; and
- optimizer (Adam(1 × 10−5)).
2.4. Network Architecture
- We applied transfer learning by taking the classic pre-trained model chosen without its last classification layer (Table 2). We replaced this layer by another one, more adapted to the new data; and
- We applied fine-tuning process and we made some adjustments to increase the model performance after the transfer learning step. The idea was to retrain the previously used transfer learning model after making some modification on its layers numbers, types, and new hyper parameters (learning rate, batch size, activation, and optimizer). In our case, we excluded the six last layers from any adjustment and modified only the rest of our model by applying the learning process only on the last 23 layers (Table 3).
2.5. Performance Metrics
2.6. Raspberry Pi
3. Results
3.1. Data Augmentation
3.2. Classification Report for MobileNet V2 and VGG16
3.3. Confusion Matrix
3.4. Raspberry Pi
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
ECG | Electrocardiogram |
AI | Artificial Intelligence |
DL | Deep Learning |
CVD | Cardiovascular Diseases |
CNN | Convolutional Neural Network |
MI | Myocardial infarction |
HMI | History of Myocardial Infarction |
ABH | Abnormal Heartbeat |
DNN | Deep Neural Network |
TP | True Positive |
TN | True Negative |
FP | False Positive |
FN | False Negative |
LSTM | Long Short-Term Memory Network |
RNN | Recurrent Neural Network |
IoT | Internet of Things |
References
- Brown, B.H.; Smallwood, R.H.; Barber, D.C.; Lawford, P.; Hose, D. Medical Physics and Biomedical Engineering: Medical Science Series; CRC Press: Boca Raton, FL, USA, 2017. [Google Scholar]
- Silipo, R.; Marchesi, C. Artificial neural networks for automatic ECG analysis. IEEE Trans. Signal Process. 1998, 46, 1417–1425. [Google Scholar] [CrossRef]
- Agliari, E.; Barra, A.; Barra, O.A.; Fachechi, A.; Vento, L.F.; Moretti, L. Detecting cardiac pathologies via machine learning on heart-rate variability time series and related markers. Sci. Rep. 2020, 10, 8845. [Google Scholar] [CrossRef] [PubMed]
- Dudchenko, A.; Ganzinger, M.; Kopanitsa, G. Machine Learning Algorithms in Cardiology Domain: A Systematic Review. Open Bioinform. J. 2020, 13, 25–40. [Google Scholar] [CrossRef]
- Zhang, X.; Gu, K.; Miao, S.; Zhang, X.; Yin, Y.; Wan, C.; Yu, Y.; Hu, J.; Wang, Z.; Shan, T.; et al. Automated detection of cardiovascular disease by electrocardiogram signal analysis: A deep learning system. Cardiovasc. Diagn. Ther. 2020, 10, 227–235. [Google Scholar] [CrossRef]
- Swapna, G.; Ghista, D.N.; Martis, R.J.; Ang, A.P.C.; Sree, S.V. ECG Signal generation and heart rate variability signal extraction: Signal processing, features detection, and their correlation with cardiac diseases. J. Mech. Med. Biol. 2012, 12, 12. [Google Scholar] [CrossRef]
- Chaddad, A.; Kucharczyk, M.J.; Desrosiers, C.; Okuwobi, I.P.; Katib, Y.; Zhang, M.; Rathore, S.; Sargos, P.; Niazi, T. Deep Radiomic Analysis to Predict Gleason Score in Prostate Cancer. IEEE Access 2020, 8, 167767–167778. [Google Scholar] [CrossRef]
- Han, X.; Hu, Y.; Foschini, L.; Chinitz, L.; Jankelson, L.; Ranganath, R. Deep learning models for electrocardiograms are susceptible to adversarial attack. Nat. Med. 2020, 26, 360–363. [Google Scholar] [CrossRef]
- Caldas, W.L.; Madeiro, J.P.V.; Mattos, C.L.C.; Gomes, J.P.P. A New Methodology for Classifying QRS Morphology in ECG Signals. In Proceedings of the 2020 International Joint Conference on Neural Networks (IJCNN), Glasgow, UK, 19–24 July 2020; pp. 1–9. [Google Scholar] [CrossRef]
- Corradi, F.; Buil, J.; De Canniere, H.; Groenendaal, W.; Vandervoort, P. Real Time Electrocardiogram Annotation with a Long Short Term Memory Neural Network. In Proceedings of the 2019 IEEE Biomedical Circuits and Systems Conference (BioCAS), Nara, Japan, 5 December 2019; pp. 1–4. [Google Scholar] [CrossRef]
- Johnson, K.W.; Soto, J.T.; Glicksberg, B.S.; Shameer, K.; Miotto, R.; Ali, M.; Ashley, E.; Dudley, J.T. Artificial Intelligence in Cardiology. J. Am. Coll. Cardiol. 2018, 71, 2668–2679. [Google Scholar] [CrossRef]
- Khan, A.H.; Hussain, M.; Malik, M.K. ECG Images dataset of Cardiac and COVID-19 Patients. Data Brief 2021, 34, 106762. [Google Scholar] [CrossRef]
- Khan, A.H.; Hussain, M. ECG Images dataset of Cardiac Patients. Mendeley Data V2, 2021. [Google Scholar] [CrossRef]
- Abadi, M.; Chu, A.; Goodfellow, I.; McMahan, H.B.; Mironov, I.; Talwar, K.; Zhang, L. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, 24–28 October 2016; pp. 308–318.
- Fan, J.; Ma, C.; Zhong, Y. A Selective Overview of Deep Learning. Stat. Sci. 2021, 36, 264–290. [Google Scholar] [CrossRef]
- Powers, D.M. Evaluation: From precision, recall and F-measure to ROC, informedness, markedness and correlation. arXiv 2020, arXiv:2010.16061. [Google Scholar] [CrossRef]
- Yildirim, O.; Talo, M.; Ciaccio, E.J.; Tan, R.S.; Acharya, U.R. Accurate deep neural network model to detect cardiac arrhythmia on more than 10,000 individual subject ECG records. Comput. Methods Programs Biomed. 2020, 197, 105740. [Google Scholar] [CrossRef] [PubMed]
- Murat, F.; Yildirim, O.; Talo, M.; Baloglu, U.B.; Demir, Y.; Acharya, U.R. Application of deep learning techniques for heartbeats detection using ECG signals-analysis and review. Comput. Biol. Med. 2020, 120, 103726. [Google Scholar] [CrossRef] [PubMed]
- Oh, S.L.; Ng, E.Y.; San Tan, R.; Acharya, U.R. Automated diagnosis of arrhythmia using combination of CNN and LSTM techniques with variable length heart beats. Comput. Biol. Med. 2018, 102, 278–287. [Google Scholar] [CrossRef] [PubMed]
- Lih, O.S.; Jahmunah, V.; San, T.R.; Ciaccio, E.J.; Yamakawa, T.; Tanabe, M.; Kobayashi, M.; Faust, O.; Acharya, U.R. Comprehensive electrocardiographic diagnosis based on deep learning. Artif. Intell. Med. 2020, 103, 101789. [Google Scholar] [CrossRef]
- Swapna, G.; Soman, K.P.; Vinayakumar, R. Automated detection of cardiac arrhythmia using deep learning techniques. Procedia Comput. Sci. 2018, 132, 1192–1201. [Google Scholar] [CrossRef]
- Safdarian, N.; Dabanloo, N.J.; Attarodi, G. A New Pattern Recognition Method for Detection and Localization of Myocardial Infarction Using T-Wave Integral and Total Integral as Extracted Features from One Cycle of ECG Signal. J. Biomed. Sci. Eng. 2014, 07, 818–824. [Google Scholar] [CrossRef]
- Sharma, L.N.; Tripathy, R.K.; Dandapat, S. Multiscale Energy and Eigenspace Approach to Detection and Localization of Myocardial Infarction. IEEE Trans. Biomed. Eng. 2015, 62, 1827–1837. [Google Scholar] [CrossRef]
- Mohammadzadeh-Asl, B.; Setarehdan, S.K. Neural network based arrhythmia classification using Heart Rate Variability signal. In Proceedings of the 14th European Signal Processing Conference, Florence, Italy, 4–8 September 2006; pp. 1–4. [Google Scholar]
- Vishwa, A.; Lal, M.K.; Dixit, S.; Vardwaj, P. Clasification of Arrhythmic ECG Data Using Machine Learning Techniques. Int. J. Interact. Multimedia Artif. Intell. 2011, 1, 67. [Google Scholar] [CrossRef]
- Ribeiro, A.L.P.; Ribeiro, M.H.; Paixão, G.M.M.; Oliveira, D.M.; Gomes, P.R.; Canazart, J.A.; Ferreira, M.P.S.; Andersson, C.R.; Macfarlane, P.W.; Meira, W.; et al. Automatic diagnosis of the 12-lead ECG using a deep neural network. Nat. Commun. 2020, 11, 1–9. [Google Scholar] [CrossRef]
- Hannun, A.Y.; Rajpurkar, P.; Haghpanahi, M.; Tison, G.H.; Bourn, C.; Turakhia, M.P.; Ng, A.Y. Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nat. Med. 2019, 25, 65–69. [Google Scholar] [CrossRef]
- Baloglu, U.B.; Talo, M.; Yildirim, O.; Tan, R.S.; Acharya, U.R. Classification of myocardial infarction with multi-lead ECG signals and deep CNN. Pattern Recognit. Lett. 2019, 122, 23–30. [Google Scholar] [CrossRef]
- Acharya, U.R.; Fujita, H.; Oh, S.L.; Hagiwara, Y.; Tan, J.H.; Adam, M. Application of deep convolutional neural network for automated detection of myocardial infarction using ECG signals. Inf. Sci. 2017, 415–416, 190–198. [Google Scholar] [CrossRef]
- Nonaka, N.; Seita, J. RandECG: Data Augmentation for Deep Neural Network based ECG classification. In Proceedings of the 35th Annual Conference of the Japanese Society for Artificial Intelligence, Online, 8–11 June 2021; p. 8. [Google Scholar]
- Li, Y.; Qu, Q.; Wang, M.; Yu, L.; Wang, J.; Shen, L.; He, K. Deep learning for digitizing highly noisy paper-based ECG records. Comput. Biol. Med. 2020, 127, 104077. [Google Scholar] [CrossRef] [PubMed]
- Du, N.; Cao, Q.; Yu, L.; Liu, N.; Zhong, E.; Liu, Z.; Shen, Y.; Chen, K. FM-ECG: A fine-grained multi-label framework for ECG image classification. Inf. Sci. 2020, 549, 164–177. [Google Scholar] [CrossRef]
- Koshti, M.; Ganorkar, S.; Chiari, L. IoT based health monitoring system by using Raspberry Pi and ECG signal. Int. J. Innov. Res. Sci. Eng. Technol. 2016, 5, 8977–8985. [Google Scholar]
- Cheikhrouhou, O.; Mahmud, R.; Zouari, R.; Ibrahim, M.; Zaguia, A.; Gia, T.N. One-Dimensional CNN Approach for ECG Arrhythmia Analysis in Fog-Cloud Environments. IEEE Access 2021, 9, 103513–103523. [Google Scholar] [CrossRef]
- Patil, P.; Bhole, K. Real time ECG on internet using Raspberry Pi. In Proceedings of the International Conference on Communication, Computing and Internet of Things (IC3IoT), Chennai, India, 15–17 February 2018; pp. 267–270. [Google Scholar]
- Granados, J.; Westerlund, T.; Zheng, L.; Zou, Z. IoT Platform for Real-Time Multichannel ECG Monitoring and Classification with Neural Networks. In Proceedings of the International Conference on Research and Practical Issues of Enterprise Information Systems, Shanghai, China, 18–20 October 2017; pp. 181–191. [Google Scholar]
Class | Training Dataset | Test Dataset | Total Dataset |
---|---|---|---|
Normal | 227 | 57 | 284 |
MI | 191 | 48 | 239 |
HMI | 137 | 35 | 102 |
ABH | 186 | 47 | 233 |
Total dataset | 741 | 187 | 928 |
Layer Type | Output Shape | Param |
---|---|---|
mobilenet_1.00_224 (Functional) | (None, 7, 7, 1024) | 3,228,864 |
global_average_pooling2d | (None, 1024) | 0 |
dropout (Dropout) | (None, 1024) | 0 |
dense (Dense) | (None, 1024) | 1,049,600 |
dense_1 (Dense) | (None, 1024) | 1,049,600 |
dense_2 (Dense) | (None, 512) | 524,800 |
dense_3 (Dense) | (None, 512) | 262,656 |
dense_4 (Dense) Total params: 6,118,085 Trainable params: 2,889,221 | (None, 5) | 2565 |
Non-trainable params: 3,228,864 |
Layer Type | Output Shape | Param |
---|---|---|
mobilenet_1.00_224 (Functional) | (None, 7, 7, 1024) | 3,228,864 |
global_average_pooling2d | (None, 1024) | 0 |
dropout_1 (Dropout) | (None, 1024) | 0 |
dense_5 (Dense) | (None, 1024) | 1,049,600 |
dense_6 (Dense) | (None, 1024) | 1,049,600 |
dense_7 (Dense) | (None, 512) | 524,800 |
dense_8 (Dense) | (None, 512) | 262,656 |
dense_9 (Dense) Total params: 6,117,572 Trainable params: 2,888,708 | (None, 4) | 2052 |
Non-trainable params: 3,228,864 |
Layer Type | Output Shape | Param |
---|---|---|
vgg16 (Functional) | (None, 7, 7, 512) | 14,714,688 |
flatten_1 (Flatten) | (None, 25,088) | 0 |
dense_4 (Dense) | (None, 1024) | 25,691,136 |
dense_5 (Dense) | (None, 512) | 524,800 |
dense_6 (Dense) | (None, 512) | 262,656 |
dense_7 (Dense) Total params: 41,195,332 Trainable params: 26,480,644, non-trainable params: 14,714,688 | (None, 4) | 2052 |
Layer Type | Output Shape | Param |
---|---|---|
vgg16 (Functional) | (None, 7, 7, 512) | 14,714,688 |
flatten_1 (Flatten) | (None, 25,088) | 0 |
dense (Dense) | (None, 1024) | 25,691,136 |
dense_1 (Dense) | (None, 512) | 524,800 |
dense_2 (Dense) | (None, 512) | 262,656 |
dense_3 (Dense) Total params: 41,195,332 Trainable params: 26,480,644, non-trainable params: 14,714,688 | (None, 4) | 2052 |
Precision | Recall | f1-Score | Support | |
---|---|---|---|---|
Normal | 0.95 | 0.87 | 0.91 | 47 |
Abnormal heartbeat (ABH) | 0.88 | 0.86 | 0.87 | 35 |
Previous history of MI (HMI) | 0.98 | 1.00 | 0.99 | 48 |
Myocardial infarction (MI) | 0.90 | 0.96 | 0.93 | 57 |
accuracy | 0.93 | 187 | ||
macro avg | 0.93 | 0.92 | 0.93 | 187 |
weighted avg | 0.93 | 0.93 | 0.93 | 187 |
Precision | Recall | f1-score | Support | |
---|---|---|---|---|
Normal | 1.00 | 0.89 | 0.94 | 47 |
Abnormal heartbeat (ABH) | 0.91 | 0.91 | 0.91 | 35 |
Previous history of MI (HMI) | 1.00 | 1.00 | 1.00 | 48 |
Myocardial infarction (MI) | 0.90 | 0.98 | 0.94 | 57 |
accuracy | 0.95 | 187 | ||
macro avg | 0.95 | 0.95 | 0.95 | 187 |
weighted avg | 0.95 | 0.95 | 0.95 | 187 |
Precision | Recall | f1-score | Support | |
---|---|---|---|---|
Normal | 0.95 | 0.77 | 0.85 | 47 |
Abnormal heartbeat (ABH) | 0.91 | 0.89 | 0.90 | 35 |
Previous history of MI (HMI) | 0.89 | 1.00 | 0.94 | 48 |
Myocardial infarction (MI) | 0.90 | 0.96 | 0.93 | 57 |
accuracy | 0.91 | 187 | ||
macro avg | 0.91 | 0.90 | 0.90 | 187 |
weighted avg | 0.91 | 0.91 | 0.91 | 187 |
Precision | Recall | f1-score | Support | |
---|---|---|---|---|
Normal | 0.95 | 0.87 | 0.91 | 47 |
Abnormal heartbeat (ABH) | 0.94 | 0.89 | 0.91 | 35 |
Previous history of MI (HMI) | 1.00 | 1.00 | 1.00 | 48 |
Myocardial infarction (MI) | 0.90 | 1.00 | 0.95 | 57 |
accuracy | 0.95 | 187 | ||
macro avg | 0.95 | 0.94 | 0.94 | 187 |
weighted avg | 0.95 | 0.95 | 0.95 | 187 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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
Mhamdi, L.; Dammak, O.; Cottin, F.; Dhaou, I.B. Artificial Intelligence for Cardiac Diseases Diagnosis and Prediction Using ECG Images on Embedded Systems. Biomedicines 2022, 10, 2013. https://doi.org/10.3390/biomedicines10082013
Mhamdi L, Dammak O, Cottin F, Dhaou IB. Artificial Intelligence for Cardiac Diseases Diagnosis and Prediction Using ECG Images on Embedded Systems. Biomedicines. 2022; 10(8):2013. https://doi.org/10.3390/biomedicines10082013
Chicago/Turabian StyleMhamdi, Lotfi, Oussama Dammak, François Cottin, and Imed Ben Dhaou. 2022. "Artificial Intelligence for Cardiac Diseases Diagnosis and Prediction Using ECG Images on Embedded Systems" Biomedicines 10, no. 8: 2013. https://doi.org/10.3390/biomedicines10082013
APA StyleMhamdi, L., Dammak, O., Cottin, F., & Dhaou, I. B. (2022). Artificial Intelligence for Cardiac Diseases Diagnosis and Prediction Using ECG Images on Embedded Systems. Biomedicines, 10(8), 2013. https://doi.org/10.3390/biomedicines10082013