基于改进交叉熵损失函数与Transformer的心电信号高风险分类研究
Transformer-Based High-Risk ECG Signal Classification with an Enhanced Cross-Entropy Loss
摘要: 在心血管疾病早期筛查过程中,能够有效检测出心电信号中高风险部分对于防止患者发生心跳骤停有重大作用,在此背景下,我们利用PhysioNet带有高风险标签的心电图小片段数据集(ECG Fragment Database with High-Risk Labels, v1.0.0)进行研究,提出了一种基于随机森林特征选择以及 Transformer 分类器的心电图高风险分类算法同时提出一种新的交叉熵损失函数ECGLoss。此损失函数包括焦点损失以及置信度惩罚两部分:焦点损失通过对权重放大难以区分样本梯度影响,置信度惩罚给低置信度正确分类增加约束,使网络更关注边缘样本分类。使用5折分层交叉验证评价此模型性能,在ECGLoss与普通交叉熵损失之间比较两者分类准确率及收敛速度。实验结果显示,提出的ECGLoss比普通的交叉熵损失有更高的分类准确率,说明此损失函数对于心电信号高危分类是有效的。
Abstract: In the early screening of cardiovascular diseases, the effective detection of high-risk segments within electrocardiogram (ECG) signals plays a crucial role in preventing sudden cardiac arrest in patients. Against this backdrop, we conduct our study using the PhysioNet ECG Fragment Database with High-Risk Labels (v1.0.0), a dataset comprising short ECG segments annotated with high-risk labels. We propose an ECG high-risk classification algorithm that integrates random forest-based feature selection with Transformer classifier, and simultaneously introduce a novel cross-entropy loss function termed ECGLoss. This loss function consists of two components: focal loss and a confidence penalty. The focal loss component amplifies the gradient impact of difficult-to-classify samples through weight scaling, while the confidence penalty imposes an additional constraint on correctly classified samples with low confidence, thereby compelling the network to focus more on borderline sample classification. The model performance is evaluated using five-fold stratified cross-validation, with ECGLoss and the standard cross-entropy loss compared in terms of both classification accuracy and convergence speed. Experimental results demonstrate that the proposed ECGLoss achieves higher classification accuracy than the conventional cross-entropy loss, indicating that this loss function is effective for high-risk classification of ECG signals.
文章引用:李嘉言. 基于改进交叉熵损失函数与Transformer的心电信号高风险分类研究[J]. 计算机科学与应用, 2026, 16(6): 332-342. https://doi.org/10.12677/csa.2026.166232

参考文献

[1] 宋喜国, 邓亲恺. MIT-BIH心率失常数据库的识读及应用[J]. 中国医学物理学杂志, 2004, 21(4): 230-232.
[2] Goldberger, A.L., Amaral, L.A.N., Glass, L., Hausdorff, J.M., Ivanov, P.C., Mark, R.G., et al. (2000) PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation, 101, e215-e220. [Google Scholar] [CrossRef] [PubMed]
[3] 张丹, 隋文涛, 梁钊, 等. 基于深度残差网络的心律失常自动分类算法研究[J]. 电子测量与仪器学报, 2019, 33(4): 140-145.
[4] Dosovitskiy, A., Beyer, L., Kolesnikov, A., et al. (2021) An Image Is Worth 16 × 16 Words: Transformers for Image Recognition at Scale. International Conference on Learning Representations (ICLR), Vienna, 3-7 May 2021.
[5] 刘光达, 周葛, 董梦坤, 等. 基于FFNN和1D-CNN的实时心律失常诊断系统与算法[J]. 电子测量与仪器学报, 2021, 35(3): 35-42.
[6] Hannun, A.Y., Rajpurkar, P., Haghpanahi, M., Tison, G.H., Bourn, C., Turakhia, M.P., et al. (2019) Cardiologist-Level Arrhythmia Detection and Classification in Ambulatory Electrocardiograms Using a Deep Neural Network. Nature Medicine, 25, 65-69. [Google Scholar] [CrossRef] [PubMed]
[7] Wang, Y., Yang, G., Li, S., Li, Y., He, L. and Liu, D. (2023) Arrhythmia Classification Algorithm Based on Multi-Head Self-Attention Mechanism. Biomedical Signal Processing and Control, 79, Article ID: 104206. [Google Scholar] [CrossRef
[8] Vaswani, A., et al. (2017) Attention Is All You Need. Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, 4-9 December 2017, 6000-6010.
[9] 李明阳, 王磊, 张伟, 等. 基于多尺度特征融合与注意力机制的心律失常检测[J]. 计算机研究与发展, 2023, 60(8): 1789-1801.
[10] Ribeiro, A.H., Ribeiro, M.H., Paixão, G.M.M., Oliveira, D.M., Gomes, P.R., Canazart, J.A., et al. (2020) Automatic Diagnosis of the 12-Lead ECG Using a Deep Neural Network. Nature Communications, 11, Article No. 1760. [Google Scholar] [CrossRef] [PubMed]