{"title":"SynthECG: Python Framework and ECG Image Datasets for Digitization, Lead Detection, and Waveform Segmentation.","authors":"Masoud Rahimi, Reza Karbasi, Abdol-Hossein Vahabie","doi":"10.4103/jmss.jmss_58_25","DOIUrl":null,"url":null,"abstract":"<p><strong>Background: </strong>Digitizing electrocardiogram (ECG) images into structured time-series data is critical for clinical analysis, but it remains challenging due to the lack of standardized datasets, especially under realistic scenarios like overlapping waveforms.</p><p><strong>Methods: </strong>We introduce SynthECG, an open-source Python framework to generate four synthetic ECG datasets tailored for deep learning tasks, including ECG digitization, YOLO-based lead and lead name detection, and U-Net-based waveform segmentation. The framework supports customizable parameters (e.g., dataset size, lead layout, and visual style) and allows generating up to 21,799 images for multi-lead datasets and 261,588 for single-lead segmentation. Notably, it introduces a novel mechanism to simulate overlapping waveforms from adjacent leads while preserving clean segmentation masks.</p><p><strong>Results: </strong>Using our framework, we generated four open-access datasets: (1) 2000 ECG images in various lead configurations paired with time-series signals for ECG digitization, (2) 2000 ECG images in various lead configurations with YOLO-format annotations for detecting lead regions and lead names, (3) 20,000 cropped single-lead images with pixel-level segmentation masks (normal variant), and (4) 102 cropped single-lead images with overlapping waveforms from adjacent leads (overlapping variant). We validated these datasets through two case studies: digitization using a non-ML algorithm (mean squared error: 0.002, ρ: 0.93, signal-to-noise ratio [SNR]: 7.36 dB, SNR<sub>med</sub>: 37.86 dB) and lead/name detection using YOLOv8.</p><p><strong>Conclusions: </strong>Our open-source framework enables the generation of large-scale, customizable ECG image datasets to support key deep learning-based tasks, including digitization under normal and overlapping conditions, as well as lead region and lead name detection. The full datasets and code are publicly available at: https://doi.org/10.5281/zenodo.15484519 and https://github.com/rezakarbasi/ecg-image-and-signal-dataset.</p>","PeriodicalId":37680,"journal":{"name":"Journal of Medical Signals & Sensors","volume":"16 ","pages":"8"},"PeriodicalIF":1.8000,"publicationDate":"2026-03-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13152245/pdf/","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Medical Signals & Sensors","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4103/jmss.jmss_58_25","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/1/1 0:00:00","PubModel":"eCollection","JCR":"Q4","JCRName":"ENGINEERING, BIOMEDICAL","Score":null,"Total":0}
引用次数: 0
Abstract
Background: Digitizing electrocardiogram (ECG) images into structured time-series data is critical for clinical analysis, but it remains challenging due to the lack of standardized datasets, especially under realistic scenarios like overlapping waveforms.
Methods: We introduce SynthECG, an open-source Python framework to generate four synthetic ECG datasets tailored for deep learning tasks, including ECG digitization, YOLO-based lead and lead name detection, and U-Net-based waveform segmentation. The framework supports customizable parameters (e.g., dataset size, lead layout, and visual style) and allows generating up to 21,799 images for multi-lead datasets and 261,588 for single-lead segmentation. Notably, it introduces a novel mechanism to simulate overlapping waveforms from adjacent leads while preserving clean segmentation masks.
Results: Using our framework, we generated four open-access datasets: (1) 2000 ECG images in various lead configurations paired with time-series signals for ECG digitization, (2) 2000 ECG images in various lead configurations with YOLO-format annotations for detecting lead regions and lead names, (3) 20,000 cropped single-lead images with pixel-level segmentation masks (normal variant), and (4) 102 cropped single-lead images with overlapping waveforms from adjacent leads (overlapping variant). We validated these datasets through two case studies: digitization using a non-ML algorithm (mean squared error: 0.002, ρ: 0.93, signal-to-noise ratio [SNR]: 7.36 dB, SNRmed: 37.86 dB) and lead/name detection using YOLOv8.
Conclusions: Our open-source framework enables the generation of large-scale, customizable ECG image datasets to support key deep learning-based tasks, including digitization under normal and overlapping conditions, as well as lead region and lead name detection. The full datasets and code are publicly available at: https://doi.org/10.5281/zenodo.15484519 and https://github.com/rezakarbasi/ecg-image-and-signal-dataset.
期刊介绍:
JMSS is an interdisciplinary journal that incorporates all aspects of the biomedical engineering including bioelectrics, bioinformatics, medical physics, health technology assessment, etc. Subject areas covered by the journal include: - Bioelectric: Bioinstruments Biosensors Modeling Biomedical signal processing Medical image analysis and processing Medical imaging devices Control of biological systems Neuromuscular systems Cognitive sciences Telemedicine Robotic Medical ultrasonography Bioelectromagnetics Electrophysiology Cell tracking - Bioinformatics and medical informatics: Analysis of biological data Data mining Stochastic modeling Computational genomics Artificial intelligence & fuzzy Applications Medical softwares Bioalgorithms Electronic health - Biophysics and medical physics: Computed tomography Radiation therapy Laser therapy - Education in biomedical engineering - Health technology assessment - Standard in biomedical engineering.