ABC-GAN: An Attention-Based Conditional GAN with DTW Loss for ECG Signal Generation to Address Class Imbalance
محورهای موضوعی : Signal Processing
Parmida Behain
1
,
Noushin Riahi
2
1 - Department of Computer Engineering, Alzahra University, Tehran
2 - Department of Computer Engineering, Alzahra University, Tehran
کلید واژه: ECG Signal Synthesis, Generative Adversarial Network (GAN), Attention Mechanism, Conditional GAN, Dynamic Time Warping (DTW), Class Imbalance, Data Augmentation,
چکیده مقاله :
The imbalance between normal and pathological cases in Electrocardiogram (ECG) datasets significantly degrades the performance of automated deep learning-based diagnostic systems, particularly for minority classes. This paper introduces ABC-GAN, a novel Attention-Based Conditional Generative Adversarial Network designed to mitigate this critical data imbalance by generating high-fidelity, class-specific synthetic ECG signals. Our proposed model incorporates two key innovations: an attention mechanism within the generator to focus on critical morphological features of the ECG waveform, and the integration of Dynamic Time Warping (DTW) as a distance metric in the generator's loss function to better preserve essential temporal dynamics. Trained and thoroughly evaluated on the MIT-BIH Arrhythmia dataset across seven different heartbeat classes, ABC-GAN successfully generates highly realistic signals that closely match the original data's distribution. When used to augment the training set, these synthetic signals significantly enhance classifier performance and generalization. A downstream classifier achieved an accuracy of 95%, representing a substantial improvement over the baseline trained on the raw imbalanced data and clearly outperforming both standard oversampling techniques and a vanilla Conditional GAN (cGAN). The overall findings demonstrate that ABC-GAN is a powerful and effective tool for data augmentation, fully capable of improving diagnostic accuracy in cardiac research and practical clinical applications.
The imbalance between normal and pathological cases in Electrocardiogram (ECG) datasets significantly degrades the performance of automated deep learning-based diagnostic systems, particularly for minority classes. This paper introduces ABC-GAN, a novel Attention-Based Conditional Generative Adversarial Network designed to mitigate this critical data imbalance by generating high-fidelity, class-specific synthetic ECG signals. Our proposed model incorporates two key innovations: an attention mechanism within the generator to focus on critical morphological features of the ECG waveform, and the integration of Dynamic Time Warping (DTW) as a distance metric in the generator's loss function to better preserve essential temporal dynamics. Trained and thoroughly evaluated on the MIT-BIH Arrhythmia dataset across seven different heartbeat classes, ABC-GAN successfully generates highly realistic signals that closely match the original data's distribution. When used to augment the training set, these synthetic signals significantly enhance classifier performance and generalization. A downstream classifier achieved an accuracy of 95%, representing a substantial improvement over the baseline trained on the raw imbalanced data and clearly outperforming both standard oversampling techniques and a vanilla Conditional GAN (cGAN). The overall findings demonstrate that ABC-GAN is a powerful and effective tool for data augmentation, fully capable of improving diagnostic accuracy in cardiac research and practical clinical applications.
[1] G. Chen et al., "EmotionalGAN: Generating ECG to Enhance Emotion State Classification," 2019.
[2] E. Adib, F. Afghah, and J. J. Prevost, "Arrhythmia Classification using CGAN-augmented ECG Signals," arXiv preprint arXiv:2201.12345, 2022.
[3] N. P. Singh et al., "Remote Monitoring System of Heart Conditions for Elderly," Journal of Information Systems and Telecommunication (JIST), (accessed online).
[4] A. Sandooghdar and F. Yaghmaee, "Deep Learning Approach for Cardiac MRI Images," Journal of Information Systems and Telecommunication (JIST), vol. 10, no. 37, pp. xx–yy, 2022.
[5] A. Halder Roy, "Integrating Questionnaires and Physiological Signals for Stress Detection," Journal of Information Systems and Telecommunication (JIST), Jul. 2025.
[6] F. Zhu et al., "Electrocardiogram generation with a bidirectional LSTM-CNN generative adversarial network," Scientific Reports, vol. 9, no. 1, p. 107, 2019.
[7] Y.-H. Zhang and S. Babaeizadeh, "Synthesis of standard 12-lead electrocardiograms using two-dimensional generative adversarial networks," Journal of Electrocardiology, vol. 69, pp. 1–9, 2021.
[8] N. Wulana et al., "Generating electrocardiogram signals by deep learning," Neurocomputing, vol. 404, pp. 1–11, 2020.
[9] P. Wang et al., "ECG Arrhythmias Detection Using Auxiliary Classifier Generative Adversarial Network and Residual Network," IEEE Access, vol. 7, pp. 1–10, 2019.
[10] W. Li et al., "SLC-GAN: An automated myocardial infarction detection model based on generative adversarial networks and convolutional neural networks with single-lead electrocardiogram synthesis," Information Sciences, vol. 589, pp. 1–12, 2021.
[11] H. Yang et al., "ProEGAN-MS: A Progressive Growing Generative Adversarial Networks for Electrocardiogram Generation," IEEE Access, vol. 9, pp. 1–10, 2021.
[12] S. Dasgupta, S. Das, and U. Bhattacharya, "CardioGAN: An Attention-based Generative Adversarial Network for Generation of Electrocardiograms," in Proc. 25th ICPR, 2021.
[13] R. Banerjee and A. Ghose, "Synthesis of Realistic ECG Waveforms Using a Composite Generative Adversarial Network for Classification of Atrial Fibrillation," in Proc. 29th EUSIPCO, 2021.
[14] X. Li et al., "TTS-GAN: A Transformer-Based Time-Series Generative Adversarial Network," in Artificial Intelligence in Medicine. AIME 2022. LNCS, vol. 13263, Springer, 2022.
[15] E. Brophy, "Synthesis of Dependent Multichannel ECG using Generative Adversarial Networks," in Proc. 29th ACM CIKM, 2020.
[16] S. Harada, H. Hayashi, and S. Uchida, "Biosignal Data Augmentation Based on Generative Adversarial Networks," in EMBC 2018, 2018.
[17] J. Chen et al., "ME-GAN: Learning Panoptic Electrocardio Representations for Multi-view ECG Synthesis Conditioned on Heart Diseases," in ICML 2022, 2022.
[18] F. Ye et al., "ECG Generation With Sequence Generative Adversarial Nets Optimized by Policy Gradient," IEEE Access, vol. 7, pp. 1–10, 2019.
[19] V. V. Kuznetsov et al., "Interpretable Feature Generation in ECG Using a Variational Autoencoder," Frontiers in Genetics, vol. 12, p. 634, 2021.
[20] T. Golany and K. Radinsky, "PGANs: Personalized Generative Adversarial Networks for ECG Synthesis to Improve Patient-Specific Deep ECG Classification," in AAAI 2019, 2019.
[21] M. S. Munia, M. Nourani, and S. Houari, "Biosignal Oversampling Using Wasserstein Generative Adversarial Network," in ICHI 2020, 2020.
[22] D. Nankani and R. D. Baruah, "Investigating Deep Convolution Conditional GANs," in IJCNN 2020, 2020.
[23] F. N. Hatamian et al., "The Effect of Data Augmentation on Classification of Atrial Fibrillation in Short Single-Lead," in ICASSP 2020, 2020.
[24] T. Agarwal and E. Ertin, "CardiacGen: A Hierarchical Deep Generative Model for ECG Synthesis," 2022.
[25] E. Adib et al., "Synthetic ECG Signal Generation Using Probabilistic Diffusion Models," IEEE Access, vol. 11, pp. 75818–75828, 2023.
[26] X. Li, E. Adib, and A. M. Rahmani, “CECG-GAN: Conditional ECG Generation for Class-Imbalanced Cardiac Diagnosis Using GANs,” Scientific Reports, vol. 14, no. 1, p. 14767, 2024, doi: 10.1038/s41598-024-65619-8.
[27] K. Lang and Y. Li, “Task-Aware Conditional GAN with Multi-Objective Loss for Realistic and Efficient Time-Series Generation,” Journal of Big Data, vol. 12, 2025, Art. no. 206, doi: 10.1186/s40537-025-01266-8.
[28] N. Neifar, A. Ben-Hamadou, A. Mdhaffar, and M. Jmaiel, “DiffECG: A Versatile Probabilistic Diffusion Model for ECG Signal Synthesis,” in Proc. IEEE/ACIS Int. Conf. Software Engineering Research, Management and Applications (SERA), 2024, pp. 182–188, doi: 10.1109/SERA61261.2024.10685651.
[29] Y. Lai, B. Liu, X. Guan, Q. Zhao, and S. Hong, “ECGTwin: Personalized ECG Generation Using Controllable Diffusion Model,” arXiv:2508.02720, 2025. [Online]. Available: https://arxiv.org/abs/2508.02720.
[30] L. Simone, D. Bacciu, and V. Gervasi, “ECG Synthesis for Cardiac Arrhythmias: Integrating Self-Supervised Learning and Generative Adversarial Networks,” Artificial Intelligence in Medicine, vol. 167, p. 103162, 2025, doi: 10.1016/j.artmed.2025.103162.
[31] Y. Lin, J. Ma, S. Dong, C. Sun, W. Cong, and K. Wang, “TransDiffECG: Semantically Controllable ECG Synthesis via Transformer-Based Diffusion Modeling,” Journal of Biomedical Informatics, vol. 172, p. 104948, 2025, doi: 10.1016/j.jbi.2025.104948.
[32] P. Li, Y. Zhou, J. Min, Y. Wang, W. Liang, and W. Li, “RDiffGAN-ECG: High-Fidelity R-Peak Conditional ECG Generation Using Diffusion GAN with State Space Models,” Biomedical Signal Processing and Control, vol. 108, p. 108544, 2025, doi: 10.1016/j.bspc.2025.108544.
[33] M. Mirza and S. Osindero, "Conditional Generative Adversarial Nets," arXiv preprint arXiv:1411.1784, 2014.
[34] I. Goodfellow et al., "Generative Adversarial Nets," in Advances in Neural Information Processing Systems (NIPS), 2014, pp. 2672–2680.
[35] A. Vaswani et al., "Attention Is All You Need," in Advances in Neural Information Processing Systems (NIPS), 2017, pp. 5998–6008.
[36] H. Zhang, I. Goodfellow, D. Metaxas, and A. Odena, "Self-Attention Generative Adversarial Networks," in Proc. ICML, 2019, pp. 7354–7363.
[37] M. Arjovsky, S. Chintala, and L. Bottou, "Wasserstein Generative Adversarial Networks," in Proc. 34th ICML, 2017.
[38] A. Lyashuk, "ECG Classification," [Online]. Available: https://github.com/lxdv/ecgclassification/blob/master/README.md, 2021.
[39] K. He et al., "Deep residual learning for image recognition," in Proc. IEEE Conf. CVPR, 2016, pp. 770–778.
[40] G. B. Moody and R. G. Mark, "The impact of the MIT-BIH Arrhythmia Database," IEEE Engineering in Medicine and Biology Magazine, vol. 20, no. 3, pp. 45–50, 2001.
[41] A. M. Delaney, E. Brophy, and T. E. Ward, "Synthesis of realistic ECG using generative adversarial networks," arXiv preprint arXiv:1903.09633, 2019.
[42] S. Harada, H. Hayashi, and S. Uchida, "Biosignal Generation and Latent Variable Analysis With Recurrent Generative Adversarial Networks," IEEE Access, vol. 7, pp. 1–10, 2019.
[43] K. F. Hossain et al., "ECG-Adv-GAN: Detecting ECG Adversarial Examples with Conditional Generative Adversarial Networks," in Proc. 20th IEEE ICMLA, 2021.
[44] A. M. Shaker et al., "Generalization of Convolutional Neural Networks for ECG Classification Using Generative Adversarial Networks," IEEE Access, vol. 8, pp. 1–10, 2020.
[45] T. Golany et al., "Improving ECG Classification Using Generative Adversarial Networks," in IAAI-20, 2020.
[46] A. Furdui et al., "AC-WGAN-GP: Augmenting ECG and GSR Signals using Conditional Generative Models for Arousal Classification," 2021.
[47] Y.-Y. Jo et al., "ECGT2T: Towards Synthesizing Twelve-Lead Electrocardiograms from Two Asynchronous Leads," in ICASSP 2023, pp. 1–5.
[48] T. Lan et al., "Arrhythmias Classification Using Short-Time Fourier Transform," in EMBC 2020, 2020.
[49] A. Goldberger et al., "Components of a new research resource for complex physiologic signals: PhysioBank, PhysioToolkit, and PhysioNet," Circulation, vol. 101, no. 23, pp. E215–E220, 2000.