Optimization of Convolutional Neural Networks Using Genetic Algorithms for the Classification of Arrhythmias in Skeletonized ECG Images
Abstract
1. Introduction
2. Materials and Methods
2.1. Dataset and Clinical Environment
- Training (70%): 15,885 images to optimize network synaptic weights;
- Validation (10%): 2269 images to monitor overfitting and guide GA selection;
- Testing and Prediction (20%): 4539 images for final, exclusive evaluation of both models.
2.2. Morphological Skeletonization
2.3. Heuristic Model Architecture
2.4. Model Optimized Using Genetic Algorithm
3. Results
3.1. Heuristic Model Performance
3.2. Performance of the Optimized Model
3.3. Comparative Analysis and Training Dynamics
4. Discussion
4.1. Heuristic Model vs. Optimized Model
4.2. Comparison with the High-Complexity Literature
4.3. Morphological Efficiency vs. 1D and Hybrid Models
5. Conclusions
- Skeletonization. Skeletonization in image preprocessing proved highly effective. This process preserves QRS complex topology while eliminating signal noise, thereby accelerating training convergence.
- Optimization process. The GA enables the discovery of novel NAS configurations that surpass heuristic model limitations. It substantially improved both overall and class-specific sensitivity, delivering gains in minority class detection (S, V, F).
- Clinical balance. Although accuracy improvement between models remained modest, gains overall and arrhythmia-specific sensitivity validate greater reliability for detecting rare pathologies.
- Performance. Unlike prior models reporting above 99% accuracy through dataset balancing, this work avoids such preprocessing. Results thus reflect genuine clinical efficacy and robustness, alongside reduced computational cost via morphological simplification through evolutionary optimization.
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Acharya, U.R.; Oh, S.L.; Hagiwara, Y.; Tan, J.H.; Adeli, H. Deep convolutional neural network for the automated detection and diagnosis of seizure using EEG signals. Comput. Biol. Med. 2018, 100, 270–278. [Google Scholar] [CrossRef]
- Sellami, A.; Hwang, H. A robust deep convolutional neural network with batch-weighted loss for heartbeat classification. Expert Syst. Appl. 2019, 122, 75–84. [Google Scholar] [CrossRef]
- Rahula, S.; Rajanikumari, L.V. Arrhythmia classification using scalogram-based EfficientNet. In Proceedings of the 2025 IEEE International Students’ Conference on Electrical, Electronics and Computer Science (SCEECS), Bhopal, India, 18–19 January 2025; pp. 1–5. [Google Scholar] [CrossRef]
- Ben Slama, A.; Amri, Y.; Fnaiech, A.; Sahli, H. Automated ECG arrhythmia classification using hybrid CNN-SVM architectures. J. Electron. Sci. Technol. 2025, 23, 100316. [Google Scholar] [CrossRef]
- Ajitha Gladis, K.P.; Ahilan, A.; Muthukumaran, N.; Jenifer, L. ECG Arrhythmia Measurement and Classification for Portable Monitoring. Meas. Sci. Rev. 2024, 24, 118–128. [Google Scholar] [CrossRef]
- Bayani, A.; Kargar, M. LDCNN: A new arrhythmia detection technique with ECG signals using a linear deep convolutional neural network. Physiol. Rep. 2024, 12, e16182. [Google Scholar] [CrossRef]
- Ahmed, A.E.S.; Abbas, Q.; Daadaa, Y.; Qureshi, I.; Perumal, G.; Ibrahim, M.E.A. A Residual-Dense-Based Convolutional Neural Network Architecture for Recognition of Cardiac Health Based on ECG Signals. Sensors 2023, 23, 7204. [Google Scholar] [CrossRef]
- Ahmed, A.A.; Ali, W.; Abdullah, T.A.A.; Malebary, S.J. Classifying cardiac arrhythmia from ECG signal using 1D CNN deep learning model. Mathematics 2023, 11, 562. [Google Scholar] [CrossRef]
- Alamatsaz, N.; Tabatabaei, L.; Yazdchi, M.; Payan, H.; Alamatsaz, N.; Nasimi, F. A lightweight hybrid CNN-LSTM explainable model for ECG-based arrhythmia detection. Biomed. Signal Process. Control 2024, 90, 105884. [Google Scholar] [CrossRef]
- Wang, Z.; Stavrakis, S.; Yao, B. Hierarchical deep learning with Generative Adversarial Network for automatic cardiac diagnosis from ECG signals. Comput. Biol. Med. 2023, 155, 106641. [Google Scholar] [CrossRef]
- Zubair, M.; Kim, J.; Yoon, C. An automated ECG beat classification system using convolutional neural networks. In Proceedings of the 6th International Conference on IT Convergence and Security (ICITCS), Prague, Czech Republic, 26 September 2016; pp. 1–5. [Google Scholar] [CrossRef]
- Goldberger, A.L.; Amaral, L.A.N.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.-K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet. Circulation 2000, 101, e215–e220. [Google Scholar] [CrossRef]
- 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]
- Association for the Advancement of Medical Instrumentation. Testing and Reporting Performance Results of Cardiac Rhythm and ST-Segment Measurement Algorithms; Association for the Advancement of Medical Instrumentation: Arlington, VA, USA, 2003. [Google Scholar]
- He, H.; Garcia, E.A. Learning from imbalanced data. IEEE Trans. Knowl. Data Eng. 2009, 21, 1263–1284. [Google Scholar] [CrossRef]
- Köhler, B.-U.; Hennig, C.; Orglmeister, R. The principles of software QRS detection. IEEE Eng. Med. Biol. Mag. 2002, 21, 42–57. [Google Scholar] [CrossRef]
- Zhang, T.Y.; Suen, C.Y. A fast parallel algorithm for thinning digital patterns. Commun. ACM 1984, 27, 236–239. [Google Scholar] [CrossRef]
- Lam, L.; Lee, S.-W.; Suen, C.Y. Thinning methodologies—A comprehensive survey. IEEE Trans. Pattern Anal. Mach. Intell. 1992, 14, 869–885. [Google Scholar] [CrossRef]
- Davies, E.R. Computer and Machine Vision: Theory, Algorithms, Practicalities; Academic Press: Waltham, MA, USA, 2012. [Google Scholar]
- Young, I.T. Image analysis and mathematical morphology, by J. Serra. Academic Press, London, 1982, xviii + 610 p. $90.00. Cytometry 1983, 4, 184–185. [Google Scholar] [CrossRef]
- Soille, P.; Pesaresi, M. Advances in mathematical morphology applied to geoscience and remote sensing. IEEE Trans. Geosci. Remote Sens. 2002, 40, 2042–2055. [Google Scholar] [CrossRef]
- LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef] [PubMed]
- O’Shea, K.; Nash, R. An introduction to convolutional neural networks. arXiv 2015, arXiv:1511.08458. [Google Scholar] [CrossRef]
- Elsken, T.; Metzen, J.H.; Hutter, F. Neural architecture search: A survey. J. Mach. Learn. Res. 2019, 20, 1–21. [Google Scholar] [CrossRef]
- Zoph, B.; Le, Q.V. Neural architecture search with reinforcement learning. In Proceedings of the International Conference on Learning Representations (ICLR), Toulon, France, 24–26 April 2017; Available online: https://arxiv.org/abs/1611.01578 (accessed on 17 March 2026).
- Holland, J.H. Adaptation in Natural and Artificial Systems; The MIT Press: Cambridge, MA, USA, 1992. [Google Scholar] [CrossRef]
- Juba, B.; Le, H.S. Precision-recall versus accuracy and the role of large data sets. Proc. AAAI Conf. Artif. Intell. 2019, 33, 4039–4048. [Google Scholar] [CrossRef]
- Saito, T.; Rehmsmeier, M. The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets. PLoS ONE 2015, 10, e0118432. [Google Scholar] [CrossRef]
- Kramer, O. Genetic Algorithms; Springer: Berlin/Heidelberg, Germany, 2017; pp. 11–19. [Google Scholar] [CrossRef]
- Whitley, D. A genetic algorithm tutorial. Stat. Comput. 1994, 4, 65–85. [Google Scholar] [CrossRef]
- de Chazal, P.; O’Dwyer, M.; Reilly, R.B. Automatic classification of heartbeats using ECG morphology and heartbeat interval features. IEEE Trans. Biomed. Eng. 2004, 51, 1196–1206. [Google Scholar] [CrossRef]
- André, L.; Paulo, L.; Ana, F.; Renato, L. Real time electrocardiogram segmentation for finger based ECG biometrics. In Proceedings of the International Conference on Bio-Inspired Systems and Signal Processing; SciTePress—Science and Technology Publications; Science and Technology Publications: Setúbal, Portugal, 2012; pp. 49–54. [Google Scholar] [CrossRef]
- Mar, T.; Zaunseder, S.; Martínez, J.P.; Llamedo, M.; Poll, R. Optimization of ECG classification by means of feature selection. IEEE Trans. Biomed. Eng. 2011, 58, 2168–2177. [Google Scholar] [CrossRef] [PubMed]
- Terven, J.; Cordova, D.M.; Romero-González, J.A.; Ramírez-Pedraza, A.; Chávez-Urbiola, E.A. A comprehensive survey of loss functions and metrics in deep learning. Artif. Intell. Rev. 2025, 58, 195. [Google Scholar] [CrossRef]
- Jia, Y.; Huang, G.; Leung, H. A novel robust Kalman filter based on normal-Bernoulli distribution for non-stationary heavy-tailed measurement noise. IEEE Trans. Signal Process. 2025, 73, 4953–4968. [Google Scholar] [CrossRef]








| Heart Rhythm Label (Proportion) | Content Description | Includes Subcategories | Subclass Label Description |
|---|---|---|---|
| N (90%) | Normal Heart rhythm | L | Left Bundle branch block |
| N | Normal ECG beat | ||
| R | Right bundle branch block | ||
| e | Atrial escape | ||
| j | Borderline escape | ||
| S (3%) | Supraventricular abnormalities | A | Atrial premature beats |
| J | Borderline premature beats | ||
| S | Supraventricular premature beats | ||
| a | Abnormal atrial premature beats | ||
| V (6%) | Ventricular escape | E | Ventricular escape beat |
| V | Ventricular premature beats | ||
| F (1%) | Fusion heartbeat | F | Ventricular fusion heartbeat |
| Q | Unknown ECG beat | P | Pacing heartbeat |
| Uncategorized ECG beat | |||
| Pacing and normal fusion heartbeat |
| Population size | 15 individuals |
| Number of generations | 10 iterations |
| Fitness function | recall global |
| Selection method | Elitism |
| Mutation rate | 0.15 |
| Layer 1, layer 2, and layer 3 filters | [16, 32, 64, 128, 256] |
| Kernel size | [3 × 3, 5 × 5] |
| Precision | Recall | F1-Score | Support | |
|---|---|---|---|---|
| F | 0.8823 | 0.4687 | 0.6122 | 32 |
| N | 0.9731 | 0.9875 | 0.9803 | 3785 |
| Q | 0.9968 | 0.9875 | 0.9921 | 322 |
| S | 0.8533 | 0.5765 | 0.6881 | 111 |
| V | 0.8536 | 0.8477 | 0.8506 | 289 |
| accuracy | 0.9649 | 0.9649 | 0.9649 | 0 |
| macro avg | 0.9118 | 0.7736 | 0.8247 | 4539 |
| weighted avg | 0.9636 | 0.9649 | 0.9631 | 4539 |
| Precision | Recall | F1-Score | Support | |
|---|---|---|---|---|
| F | 0.7916 | 0.5937 | 0.6785 | 32 |
| N | 0.9818 | 0.9889 | 0.9853 | 3785 |
| Q | 1 | 1 | 1 | 322 |
| S | 0.8191 | 0.6936 | 0.7512 | 111 |
| V | 0.8850 | 0.8788 | 0.8819 | 289 |
| accuracy | 0.9726 | 0.9726 | 0.9726 | 0 |
| macro avg | 0.8955 | 0.8310 | 0.8594 | 4539 |
| weighted avg | 0.9716 | 0.9726 | 0.9719 | 4539 |
| Reference | Acc % | Recall (V) % | Recall (S) % | Recall (F) % | Macro Recall (%) | Balance | Evaluation Method |
|---|---|---|---|---|---|---|---|
| Rahula [3] | 99.41 | 99.41 | 98.4 | 97.8 | 98.4 | Yes | Class-oriented (Intra-patient) |
| Ben Slama [4] | 99.28 | 98.9 | 97.45 | 96.8 | 97.71 | Yes | Class-oriented (Intra-patient) |
| Ajitha [5] | 98.54 | 97.8 | 96.1 | 94.5 | 96.13 | Not | Class-oriented (Intra-patient) |
| Bayani [6] | 99.52 | 99.15 | 98.4 | 97.9 | 98.48 | Yes | Class-oriented (Intra-patient) |
| Ahmed [7] | 99.11 | 99.04 | 97.28 | 96.01 | 97.44 | Yes | Class-oriented (Intra-patient) |
| Ahmed [8]) | 91.3 | 92.4 | 85.1 | 79.3 | 85.6 | Not | Class-oriented (Intra-patient) |
| Alamatsaz [9] | 99.16 | 99.04 | 95.83 | 92.31 | 95.72 | Yes | Class-oriented (Intra-patient) |
| Wang [10] | 99.1 | 99.2 | 98.1 | 97.3 | 98.2 | Yes | Subject-oriented (Inter-patient) |
| Heuristic Model (Present study) | 96.49 | 84.77 | 57.65 | 46.87 | 77.36 | Not | Subject-oriented (Inter-patient) |
| Optimized Model (Present study) | 97.26 | 87.88 | 69.36 | 59.37 | 83.1 | Not | Subject-oriented (Inter-patient) |
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. |
© 2026 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.
Share and Cite
Vega-De la Garza, Á.G.; Alvarez-Sánchez, E.J.; Zaballa-Contreras, J.F.; Aldana-Franco, R.; Aldana-Franco, F.; Leyva-Retureta, J.G.; López-Velázquez, A. Optimization of Convolutional Neural Networks Using Genetic Algorithms for the Classification of Arrhythmias in Skeletonized ECG Images. Computation 2026, 14, 104. https://doi.org/10.3390/computation14050104
Vega-De la Garza ÁG, Alvarez-Sánchez EJ, Zaballa-Contreras JF, Aldana-Franco R, Aldana-Franco F, Leyva-Retureta JG, López-Velázquez A. Optimization of Convolutional Neural Networks Using Genetic Algorithms for the Classification of Arrhythmias in Skeletonized ECG Images. Computation. 2026; 14(5):104. https://doi.org/10.3390/computation14050104
Chicago/Turabian StyleVega-De la Garza, Álvaro Gabriel, Ervin Jesús Alvarez-Sánchez, Julio Fernando Zaballa-Contreras, Rosario Aldana-Franco, Fernando Aldana-Franco, José Gustavo Leyva-Retureta, and Andrés López-Velázquez. 2026. "Optimization of Convolutional Neural Networks Using Genetic Algorithms for the Classification of Arrhythmias in Skeletonized ECG Images" Computation 14, no. 5: 104. https://doi.org/10.3390/computation14050104
APA StyleVega-De la Garza, Á. G., Alvarez-Sánchez, E. J., Zaballa-Contreras, J. F., Aldana-Franco, R., Aldana-Franco, F., Leyva-Retureta, J. G., & López-Velázquez, A. (2026). Optimization of Convolutional Neural Networks Using Genetic Algorithms for the Classification of Arrhythmias in Skeletonized ECG Images. Computation, 14(5), 104. https://doi.org/10.3390/computation14050104

