Long-term ECG Analysis through Image Conversion and Deep Learning

Carlos Hernández-Fernández1, Hilario Gómez-Moreno1, Roberto Holgado-Cuadrado1, Manuel Blanco-Velasco2
1Universidad de Alcalá, 2University of Alcala


Abstract

Introduction: The semi-automatic processing of long ECG signals is a problem that has not yet been solved, due to the enormous amount of information to be processed, lacking uniform structure, with large doses of distortion of a diverse nature and periods of disconnection. In this work, ECG-to-image conversion is achieved to use image processing techniques to detect anomalies, namely, premature ventricular contractions and ventricular beat fusions. Thus, the information of long ECG is parallelized into a set of image frames. Methods: The "MIT-BIH Long-Term ECG Database" containing 7 labeled electrocardiogram records from 14 to 24 hours was used. Every record was divided into segments of 65100 samples to compose a 3000x217 matrix. Those values were set in an empirical way trying to get not so large images with significant details. Finally, each matrix generated an image where the ECG values were represented using RGB colors and with a final size of 11060x800. These images were subsequently resampled into blocks of 100x100 pixels, to reduce the effect of unbalanced data, and associated to a segmentation mask marking the anomalies. Finally, we got 11000 images and their masks to create the training dataset. The ResNet50 network was used to achieve the desired semantic segmentation. Results: The results obtained marked the ventricular anomalies with 84.5% accuracy. False positives could be observed in about 5% of the pixels. However, morphological processing techniques can be used to eliminate some of these false positives. Conclusion: The use of images in the processing of long-term ECG signals makes it possible to handle large amounts of information and to use well-established and proven image processing techniques. The results obtained marking premature ventricular contractions and ventricular beat fusions support the use of these images in different ECG signal segmentation problems.