Research on a Lightweight Arrhythmia Classification Model Based on Knowledge Distillation for Wearable Single-Lead ECG Monitoring Systems
Abstract
:1. Introduction
- (1)
- Proposed a lightweight and high-performance arrhythmia classification model with significant compression: This introduced a knowledge distillation (KD)-based framework to transfer the “dark knowledge” from a multi-lead ECG teacher model to a single-lead ECG student model. The proposed approach significantly reduces model complexity while achieving a classification accuracy of 96.32%, comparable to the multi-lead teacher model, with an impressive compression ratio of 1242.58 times. Additionally, the model was rigorously validated on the Chapman–Shaoxing ECG dataset, and comparisons with existing lightweight models further demonstrated its superiority.
- (2)
- Enabled real-time deployment on resource-constrained devices: A wearable ECG monitoring system based on the STM32F429 microcontroller (manufactured by STMicroelectronics, Geneva, Switzerland) was developed, demonstrating the feasibility of real-time arrhythmia classification in resource-limited environments.
2. Related Works
2.1. Intelligent ECG Analysis
2.2. Edge Computing in Health Monitoring
2.3. Lightweight Models for Arrhythmia Classification
3. Materials and Methods
3.1. Datasets
3.2. Knowledge Distillation
- (1)
- Distillation Loss: This metric quantifies the disparity between the predictions of the student model and the soft labels provided by the teacher model, facilitating the student’s acquisition of knowledge from the teacher. The measurement of distillation loss typically employs Kullback–Leibler (KL) divergence, as indicated in Equation (3):
- (2)
- Cross-Entropy Loss: This measures the difference between the student model’s predictions and the true hard labels, ensuring that the student model maintains classification accuracy. The cross-entropy loss is shown in Equation (4):
3.2.1. Teacher Model
3.2.2. Student Model
3.3. Assessment Indicators
3.4. Result
4. Deployment of Lightweight Model
4.1. Hardware Structure
4.2. Model Deployment Based on STM32CubeAI
4.3. Performance Evaluation
4.4. System Implementation
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Chong, B.; Jayabaskaran, J.; Jauhari, S.M.; Chan, S.P.; Goh, R.; Kueh, M.T.W.; Li, H.; Chin, Y.H.; Kong, G.; Anand, V.V.; et al. Global burden of cardiovascular diseases: Projections from 2025 to 2050. Eur. J. Prev. Cardiol. 2024, zwae281. [Google Scholar] [CrossRef] [PubMed]
- 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]
- Nawaz, M.; Ahmed, J. Cloud-based healthcare framework for real-time anomaly detection and classification of 1-D ECG signals. PLoS ONE 2022, 17, e0279305. [Google Scholar] [CrossRef] [PubMed]
- Zidelmal, Z.; Amirou, A.; Ould-Abdeslam, D.; Merckle, J. ECG beat classification using a cost sensitive classifier. Comput. Methods Programs Biomed. 2013, 111, 570–577. [Google Scholar] [CrossRef] [PubMed]
- Li, T.; Zhou, M. ECG classification using wavelet packet entropy and random forests. Entropy 2016, 18, 285. [Google Scholar] [CrossRef]
- Babaoğlu, I.; Kıran, M.S.; Ülker, E.; Gündüz, M. Diagnosis of Coronary Artery Disease Using Artificial Bee Colony and K-Nearest Neighbor Algorithms. Int. J. Comput. Commun. Eng. 2013, 2, 56–59. [Google Scholar] [CrossRef]
- LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef]
- Kiranyaz, S.; Ince, T.; Gabbouj, M. Real-time patient-specific ECG classification by 1-D convolutional neural networks. IEEE Trans. Biomed. Eng. 2015, 63, 664–675. [Google Scholar] [CrossRef] [PubMed]
- Al Rahhal, M.; Bazi, Y.; AlHichri, H.; Alajlan, N.; Melgani, F.; Yager, R. Deep learning approach for active classification of electrocardiogram signals. Inf. Sci. 2016, 345, 340–354. [Google Scholar] [CrossRef]
- Han, C.; Shi, L. ML–ResNet: A novel network to detect and locate myocardial infarction using 12 leads ECG. Comput. Methods Programs Biomed. 2020, 185, 105138. [Google Scholar] [CrossRef] [PubMed]
- Mashrur, F.R.; Roy, A.D.; Saha, D.K. Automatic identification of arrhythmia from ECG using AlexNet convolutional neural network. In Proceedings of the 2019 4th International Conference on Electrical Information and Communication Technology (EICT), Khulna, Bangladesh, 20–22 December 2019; pp. 1–5. [Google Scholar]
- Jangra, M.; Dhull, S.K.; Singh, K.K. ECG arrhythmia classification using modified visual geometry group network (mVGGNet). J. Intell. Fuzzy Syst. 2020, 38, 3151–3165. [Google Scholar] [CrossRef]
- Hua, X.; Han, J.; Zhao, C.; Tang, H.; He, Z.; Chen, Q.; Tang, S.; Tang, J.; Zhou, W. A novel method for ECG signal classification via one-dimensional convolutional neural network. Multimedia Syst. 2020, 28, 1387–1399. [Google Scholar] [CrossRef]
- Boda, S.; Mahadevappa, M.; Dutta, P.K. An automated patient-specific ECG beat classification using LSTM-based recurrent neural networks. Biomed. Signal Process. Control 2023, 84, 104756. [Google Scholar] [CrossRef]
- Falaschetti, L.; Alessandrini, M.; Biagetti, G.; Crippa, P.; Turchetti, C. Ecg-based arrhythmia classification using recurrent neural networks in embedded systems. Procedia Comput. Sci. 2022, 207, 3479–3487. [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]
- Moody, G.B.; Mark, R.G. The impact of the MIT-BIH arrhythmia database. IEEE Eng. Med. Biol. Mag. 2001, 20, 45–50. [Google Scholar] [CrossRef]
- Acharya, U.R.; Oh, S.L.; Hagiwara, Y.; Tan, J.H.; Adam, M.; Gertych, A.; San Tan, R. A deep convolutional neural network model to classify heartbeats. Comput. Biol. Med. 2017, 89, 389–396. [Google Scholar] [CrossRef]
- Chen, C.; Hua, Z.; Zhang, R.; Liu, G.; Wen, W. Automated arrhythmia classification based on a combination network of CNN and LSTM. Biomed. Signal Process. Control 2020, 57, 101819. [Google Scholar] [CrossRef]
- Hong, S.; Zhou, Y.; Shang, J.; Xiao, C.; Sun, J. Opportunities and challenges of deep learning methods for electrocardiogram data: A systematic review. Comput. Biol. Med. 2020, 122, 103801. [Google Scholar] [CrossRef]
- 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]
- Meqdad, M.N.; Abdali-Mohammadi, F.; Kadry, S. A new 12-lead ECG signals fusion method using evolutionary CNN trees for arrhythmia detection. Mathematics 2022, 10, 1911. [Google Scholar] [CrossRef]
- Yoon, T.; Kang, D. Bimodal CNN for cardiovascular disease classification by co-training ECG grayscale images and scalograms. Sci. Rep. 2023, 13, 2937. [Google Scholar] [CrossRef]
- Deng, S.; Zhao, H.; Fang, W.; Yin, J.; Dustdar, S.; Zomaya, A.Y. Edge intelligence: The confluence of edge computing and artificial intelligence. IEEE Internet Things J. 2020, 7, 7457–7469. [Google Scholar] [CrossRef]
- Zhao, Y.; Liu, Y.; Zhou, H.; Wei, Y.; Yu, Y.; Lu, S.; An, X.; Liu, Q. Intelligent Gateway Based Human Cardiopulmonary Health Monitoring System. J. Sens. 2023, 2023, 3534224. [Google Scholar] [CrossRef]
- Vimal, S.; Robinson, Y.H.; Kadry, S.; Long, H.V.; Nam, Y. IoT based smart health monitoring with CNN using edge computing. J. Internet Technol. 2021, 22, 173–185. [Google Scholar]
- Abdellatif, A.A.; Samara, L.; Mohamed, A.; Erbad, A.; Chiasserini, C.F.; Guizani, M.; O’connor, M.D.; Laughton, J. Medge-chain: Leveraging edge computing and blockchain for efficient medical data exchange. IEEE Internet Things J. 2021, 8, 15762–15775. [Google Scholar] [CrossRef]
- Joukhadar, A.; Chachati, L.; Al-Mohammed, M.; Albasha, O. A portable Raspberry Pi-based system for diagnosis of heart valve diseases using automatic segmentation and artificial neural networks. Cogent Eng. 2020, 7, 1856757. [Google Scholar] [CrossRef]
- Alfarhan, K.A.; Mashor, M.Y.; Saad, A.R.M.; Omar, M.I. Wireless heart abnormality monitoring kit based on Raspberry Pi. J. Biomim. Biomater. Biomed. Eng. 2018, 35, 96–108. [Google Scholar] [CrossRef]
- Mohebbanaaz; Sai, Y.P.; Kumari, L.R. Cognitive assistant DeepNet model for detection of cardiac arrhythmia. Biomed. Signal Process. Control 2022, 71, 103221. [Google Scholar] [CrossRef]
- Zhang, H.; Liu, W.; Guo, Q.; Shi, J.; Chang, S.; Wang, H.; He, J.; Huang, Q. DDDG: A dual bi-directional knowledge distillation method with generative self-supervised pre-training and its hardware implementation on SoC for ECG. Expert Syst. Appl. 2024, 244, 122969. [Google Scholar] [CrossRef]
- Howard, A.G. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv 2017, arXiv:1704.04861. [Google Scholar]
- 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]
- Hinton, G.; Vinyals, O.; Dean, J. Distilling the knowledge in a neural network. arXiv 2015, arXiv:1503.02531. [Google Scholar]
- Sepahvand, M.; Abdali-Mohammadi, F. A novel method for reducing arrhythmia classification from 12-lead ECG signals to single-lead ECG with minimal loss of accuracy through teacher-student knowledge distillation. Inf. Sci. 2022, 593, 64–77. [Google Scholar] [CrossRef]
- Liu, Z.; Sun, M.; Zhou, T.; Huang, G.; Darrell, T. Rethinking the value of network pruning. arXiv 2018, arXiv:1810.05270. [Google Scholar]
- Zhou, Y.; Moosavi-Dezfooli, S.-M.; Cheung, N.-M.; Frossard, P. Adaptive quantization for deep neural network. In Proceedings of the AAAI Conference on Artificial Intelligence, New Orleans, LA, USA, 2–7 February 2018. [Google Scholar]
- Wu, J.; Li, F.; Chen, Z.; Pu, Y.; Zhan, M. A neural network-based ECG classification processor with exploitation of heartbeat similarity. IEEE Access 2019, 7, 172774–172782. [Google Scholar] [CrossRef]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
- Deng, X.; Liu, Q.; Deng, Y.; Mahadevan, S. An improved method to construct basic probability assignment based on the confusion matrix for classification problem. Inf. Sci. 2016, 340, 250–261. [Google Scholar] [CrossRef]
- Wang, M.; Rahardja, S.; Fränti, P.; Rahardja, S. Single-lead ECG recordings modeling for end-to-end recognition of atrial fibrillation with dual-path RNN. Biomed. Signal Process. Control 2023, 79, 104067. [Google Scholar] [CrossRef]
- Gao, J.; Zhang, H.; Lu, P.; Wang, Z. An effective LSTM recurrent network to detect arrhythmia on imbalanced ECG dataset. J. Health Eng. 2019, 2019, 6320651. [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]
Merged Rhythms | New Class Name | Number of Total Samples | Number of Training Samples | Number of Testing Samples | Age, Mean ± STD |
AF+ AFIB | AFIB | 2218 | 1983 | 235 | 72.92 ± 11.66 |
SVT + AT + SAAWR + ST+ AVNRT + AVRT | GSVT | 2260 | 2061 | 199 | 55.51 ± 20.41 |
SB | SB | 3888 | 3488 | 400 | 58.33 ±13.95 |
SR, SI | SR | 2222 | 1997 | 225 | 50.89 ± 19.18 |
All | 10,588 | 9529 | 1059 | 59.23 ± 17.97 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 91.44 | 93.12 | 98.21 | 92.27 | 96.79 |
GSVT | 94.25 | 90.64 | 97.36 | 92.41 | 96.70 |
SB | 98.46 | 97.70 | 98.66 | 98.08 | 98.58 |
SR | 93.27 | 96.74 | 99.16 | 94.98 | 97.92 |
Overall | 94.35 | 94.55 | 98.34 | 94.43 | 97.50 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 91.75 | 94.50 | 98.53 | 89.29 | 95.47 |
GSVT | 88.94 | 88.94 | 97.00 | 88.94 | 95.28 |
SB | 97.94 | 98.20 | 98.96 | 98.07 | 98.58 |
SR | 91.48 | 92.73 | 98.09 | 92.10 | 96.70 |
Overall | 92.52 | 93.59 | 98.14 | 92.10 | 96.50 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 95.05 | 84.06 | 95.23 | 89.22 | 95.19 |
GSVT | 90.27 | 94.01 | 98.44 | 92.10 | 96.70 |
SB | 97.69 | 98.45 | 99.11 | 98.06 | 98.58 |
SR | 90.58 | 98.06 | 99.52 | 94.17 | 97.64 |
Overall | 93.39 | 93.64 | 98.07 | 93.38 | 97.02 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 87.39 | 89.81 | 97.37 | 88.58 | 95.28 |
GSVT | 92.48 | 90.09 | 97.24 | 91.27 | 96.23 |
SB | 98.97 | 97.22 | 98.36 | 98.09 | 98.58 |
SR | 96.70 | 93.52 | 98.33 | 92.03 | 96.70 |
Overall | 93.88 | 92.66 | 97.82 | 92.49 | 96.69 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 66.67 | 85.06 | 96.90 | 74.75 | 90.57 |
GSVT | 91.15 | 84.43 | 95.44 | 87.66 | 94.53 |
SB | 98.71 | 96.00 | 97.62 | 97.34 | 98.02 |
SR | 91.48 | 84.30 | 95.46 | 87.74 | 94.62 |
Overall | 87.00 | 87.45 | 96.36 | 86.87 | 94.44 |
Classes | Sensitivity (%) | Precision (%) | Specificity (%) | F1-Score (%) | Accuracy (%) |
AFIB | 83.33 | 88.10 | 97.02 | 85.65 | 94.15 |
GSVT | 93.81 | 85.48 | 95.68 | 89.45 | 95.28 |
SB | 98.71 | 97.46 | 98.51 | 98.08 | 97.26 |
SR | 90.13 | 96.63 | 99.16 | 93.27 | 98.58 |
Overall | 91.50 | 91.92 | 97.59 | 91.61 | 96.32 |
Model | Test Accuracy | MACs | ROM (KiB) | RAM (KiB) | Inference Time (ms) |
RNN [41] | 92.54% | 2,784,240 | 43.84 | 67.69 | 253 |
LSTM [42] | 83.02% | 3,624,304 | 48.29 | 52.09 | 388 |
CNN_LSTM [43] | 94.71% | 905,072 | 48.70 | 35.99 | 93 |
Proposed Student Model | 96.32% | 84,184 | 25.34 | 11.65 | 19 |
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. |
© 2024 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
An, X.; Shi, S.; Wang, Q.; Yu, Y.; Liu, Q. Research on a Lightweight Arrhythmia Classification Model Based on Knowledge Distillation for Wearable Single-Lead ECG Monitoring Systems. Sensors 2024, 24, 7896. https://doi.org/10.3390/s24247896
An X, Shi S, Wang Q, Yu Y, Liu Q. Research on a Lightweight Arrhythmia Classification Model Based on Knowledge Distillation for Wearable Single-Lead ECG Monitoring Systems. Sensors. 2024; 24(24):7896. https://doi.org/10.3390/s24247896
Chicago/Turabian StyleAn, Xiang, Shiwen Shi, Qian Wang, Yansuo Yu, and Qiang Liu. 2024. "Research on a Lightweight Arrhythmia Classification Model Based on Knowledge Distillation for Wearable Single-Lead ECG Monitoring Systems" Sensors 24, no. 24: 7896. https://doi.org/10.3390/s24247896
APA StyleAn, X., Shi, S., Wang, Q., Yu, Y., & Liu, Q. (2024). Research on a Lightweight Arrhythmia Classification Model Based on Knowledge Distillation for Wearable Single-Lead ECG Monitoring Systems. Sensors, 24(24), 7896. https://doi.org/10.3390/s24247896