Abstract
An electrocardiogram (ECG) is a crucial noninvasive medical diagnostic method that enables real-time monitoring of the electrical activity of the heart. ECGs hold a significant position in the rapid diagnosis and routine monitoring of cardiac diseases due to their user-friendly operation, prompt detection, broad range of diagnosable problems, and cost-effectiveness. However, thorough comprehension of ECG readings requires a high level of medical expertise due to the complex variations in ECG patterns, substantial interindividual differences, and numerous interfering factors. Consequently, current ECG machines and ECG Holters typically provide simplistic indications of ECG anomalies. Nonetheless, current ECG anomaly detection (EAD) algorithms lack precision; therefore, these medical devices cannot accurately report the specific types of diseases reflected in ECG results. In response to these challenges, this paper proposes enhancing the accuracy of electrocardiogram detection by improving algorithms. Therefore, we propose SAPTSTA-AnoECG, a PatchTST-based ECG anomaly detection method with subtractive attention and data augmentation. This method introduces a subtractive attention mechanism to make the Transformer architecture more suitable for time series data. We also use data augmentation to increase the robustness of the model. In addition, a patch-based approach is employed to reduce the algorithm’s computational complexity of the model. Furthermore, we introduce a new publicly available ECG dataset named HCE in this paper and conduct comparative experiments using this dataset along with the PTB-XL and CPSC 2018 datasets. The experimental results demonstrate the effectiveness of this method.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Data Availability and Access
The PTB-XL dataset and CPSC 2018 dataset are both public datasets. PTB-XL dataset can be accessed at https://storage.googleapis.com/ptb-xl-1.0.1. physionet.org/ptb-xl-a-large-publicly-available-electrocardiography-dataset-1.0.1.zip, CPSC 2018 dataset can be accessed at http://2018.icbeb.org. We downloaded them in 2023. The HCE dataset is released in this paper, it can be accessed at https://github.com/SLZWVICTOR/ HCE_Dataset.
References
Roth GA, Mensah GA, Johnson CO (2020) Global burden of cardiovascular diseases and risk factors, 1990–2019: update from the gbd 2019 study. J Am Coll Cardiol 76(25):2982–3021. https://doi.org/10.1016/j.jacc.2020.11.010
Li Y, Peng X, Zhang J et al (2021) Dct-gan: Dilated convolutional transformer-based gan for time series anomaly detection. IEEE Trans Knowl Data Eng 35(4):3632–3644. https://doi.org/10.1109/TKDE.2021.3130234
Algburi RNA, Gao H, Al-Huda Z (2022) Improvement of an industrial robotic flaw detection system. IEEE Trans Automat Sci Eng 19(4):3953–3967. https://doi.org/10.1109/tase.2022.3141248
Zhong Y, Wang Z, Shi X et al (2024) Rfg-helad: A robust fine-grained network traffic anomaly detection model based on heterogeneous ensemble learning. IEEE Trans Inf Forensic Secur 19:5895–5910. https://doi.org/10.1109/TIFS.2024.3402439
Yu H, Zhang X, Wang Y et al (2024) Fine-grained accident detection: database and algorithm. IEEE Trans Image Process 33:1059–1069. https://doi.org/10.1109/TIP.2024.3355812
Algburi RNA, Gao H, Al-Huda Z (2022) A new synergy of singular spectrum analysis with a conscious algorithm to detect faults in industrial robotics. Neural Comput Appl 34(10):7565–7580. https://doi.org/10.1007/s00521-021-06848-0
Nie Y, Nguyen NH, Sinthong P, et al (2023) A time series is worth 64 words: Long-term forcasting with transformers. In: International Conference on Learning Representations., pp 1–24, https://doi.org/10.48550/arXiv.2211.14730
Xu M, Wei S, Qin X, et al (2015) Rule-based method for morphological classification of st segment in ecg signals. In: J Med Biol Eng, pp 816–823, https://doi.org/10.1007/s40846-015-0092-x
Maglaveras N, Stamkopoulos T, Diamantaras K et al (1998) Ecg pattern recognition and classification using non-linear transformations and neural networks: A review. Int J Med Inform 52(1):191–208. https://doi.org/10.1016/S1386-5056(98)00138-5
Strodthoff N, Wagner P, Schaeffter T et al (2021) Deep learning for ecg analysis: Benchmarks and insights from ptb-xl. IEEE J Biomed Health 25(5):1519–1528. https://doi.org/10.1109/JBHI.2020.3022989
Ismail FH, Lucas B, Forestier G (2020) Inceptiontime: Finding alexnet for time series classification. Data Min Knowl Disc 34(6):1936–1962. https://doi.org/10.1007/s10618-020-00710-y
He T, Zhang Z, Zhang H, et al (2019) Bag of tricks for image classification with convolutional neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp 558–567. https://doi.org/10.1109/CVPR.2019.00065
Wang Z, Yan W, Oates T (2017) Time series classification from scratch with deep neural networks: A strong baseline. In: International Joint Conference on Neural Networks., pp 1578–1585. https://doi.org/10.1109/IJCNN.2017.7966039
Liu X, Wang H, Li Z et al (2021) Deep learning in ecg diagnosis: A review. Knowl-Based Syst 2021:107187. https://doi.org/10.1016/j.knosys.2021.107187
Nurmaini S, Darmawahyuni A, Sakti MAN et al (2020) Deep learning-based stacked denoising and autoencoder for ecg heartbeat classification. Electronics 9(1):135. https://doi.org/10.3390/electronics9010135
Kazim H (2019) Deep neural network based approach for ecg classification using hybrid differential features and active learning. IET Signal Process 13(2):165–175. https://doi.org/10.1049/iet-spr.2018.5103
Lixin S, Dongzi S, Qian W et al (2019) Automatic classification method of arrhythmia based on discriminative deep belief networks. J Biomed Eng 36(3):444–452. https://doi.org/10.7507/1001-5515.201810053
Taji B, Chan AD, Shirmohammadi S (2018) False alarm reduction in atrial fibrillation detection using deep belief networks. IEEE T Instrum Meas 67(5):1124–1131. https://doi.org/10.1109/TIM.2017.2769198
Xu X, Liu H (2020) Ecg heartbeat classification using convolutional neural networks. IEEE Access 8:8614–8619. https://doi.org/10.1109/ACCESS.2020.2964749
Niu J, Tang Y, Sun Z et al (2020) Inter-patient ecg classification with symbolic representations and multi-perspective convolutional neural networks. IEEE J Biomed Health 24(5):1321–1332. https://doi.org/10.1109/JBHI.2019.2942938
Saadatnejad S, Oveisi M, Hashemi M (2020) Lstm-based ecg classification for continuous monitoring on personal wearable devices. IEEE J Biomed Health 24(2):515–523. https://doi.org/10.1109/JBHI.2019.2911367
Qiao F, Zhang X, Deng J (2020) Learning evolutionary stages with hidden semi-markov model for predicting social unrest events. In: Discrete Dyn Nat Soc, pp 1–16, https://doi.org/10.1155/2020/3915036
Zhao X, Liu Z, Han L, et al (2022) Ecgnn: Enhancing abnormal recognition in 12-lead ecg with graph neural network. In: IEEE International Conference on Bioinformatics and Biomedicine., pp 1411–1416. https://doi.org/10.1109/BIBM55620.2022.9995419
Dosovitskiy A, Beyer L, Kolesnikov A, et al (2020) An image is worth 16x16 words: Transformers for image recognition at scale. In: International Conference on Learning Representations., pp 1–22. https://doi.org/10.48550/arXiv.2010.11929
Makowski D, Pham T, Lau ZJ et al (2021) NeuroKit2: A python toolbox for neurophysiological signal processing. Behav Res Methods 53(4):1689–1696. https://doi.org/10.3758/s13428-020-01516-y
Wagner P, Strodthoff N, Bousseljot RD et al (2020) Ptb-xl, a large publicly available electrocardiography dataset. Scientific Data 7(1):154. https://doi.org/10.1038/s41597-020-0495-6
Liu F, Liu C, Zhao L et al (2018) An open access database for evaluating the algorithms of electrocardiogram rhythm and morphology abnormality detection. J Med Imag Health 8(7):1368–1373. https://doi.org/10.1166/jmihi.2018.2442
Lee G, Gommers R, Waselewski F, et al (2019) Pywavelets: A python package for wavelet analysis. J Open Source Softw 4(36):1–2. https://doi.org/10.21105/joss.01237
Liu W, Pan S, Li Z et al (2024) Lead-fusion barlow twins: A fused self-supervised learning method for multi-lead electrocardiograms. Inf Fusion 114:1–14. https://doi.org/10.1016/j.inffus.2024.102698
Qin K, Huang W, Zhang T et al (2024) A lightweight selfonn model for general ecg classification with pretraining. Biomed Signal Process Contr 89:1–12. https://doi.org/10.1016/j.bspc.2023.105780
Yang S, Lian C, Zeng Z et al (2024) Masked self-supervised ecg representation learning via multiview information bottleneck. Neural Comput Appl 36(14):7625–7637. https://doi.org/10.1007/s00521-024-09486-4
Funding
This work was partially supported by National Natural Science Foundation of China (No. 62403431, No. U21A20518, No. U23A20341, No. U22B2028, No. U1936215), the Fundamental Research Funds for the Provincial Universities of Zhejiang (No. RF-A2023009), Zhejiang Provincial Key Research and Development Projects (No. 2021C01117) and Zhejiang Provincial Natural Science Foundation of China (No. LD22F020002).
Author information
Authors and Affiliations
Contributions
Yifan Li: Conceptualization, Methodology, Writing-Original draft preparation; Mengjue Wang: Writing-Reviewing and Editing; Mingxiang Guan and Chen Lu: Data Curation, Validation; Zhiyong Li and Tieming Chen: Supervision, Writing-Reviewing and Editing.
Corresponding author
Ethics declarations
Competing Interests
All authors certify that they have no affiliations with or involvement in any organization or entity with any financial interest or non-financial interest in the subject matter or materials discussed in this manuscript.
Ethical and Informed Consent for Data Used
This study utilizes the PTB-XL dataset and CPSC 2018 dataset. They are publicly available and follows the CC BY 4.0 license. Under this license, we are authorized to use this dataset for research purposes. All personal information contained in the dataset has been anonymized to protect the privacy of the data subjects. Our study further ensures that no re-identification of any personal information will occur. We commit to adhering to all relevant laws and ethical standards in the use of data, ensuring the legality and morality of data use. We will take full responsibility for any violations.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Li, Y., Wang, M., Guan, M. et al. SAPTSTA-AnoECG: a PatchTST-based ECG anomaly detection method with subtractive attention and data augmentation. Appl Intell 55, 184 (2025). https://doi.org/10.1007/s10489-024-05881-5
Accepted:
Published:
DOI: https://doi.org/10.1007/s10489-024-05881-5