Refined Self-Attention Transformer Model for ECG-Based Arrhythmia Detection
Yanyun Tao, Biao Xu, Yuzhen Zhang
Abstract
As the length of electrocardiogram (ECG) sequences increases, most current transformer models demand substantial computational resources for ECG arrhythmia detection. Additionally, conventional single-scale tokens encounter difficulties in accommodating various patterns of arrhythmia. Thus, in this study, a refined-attention transformer model for arrhythmia detection was proposed. Our model introduces two refined attention mechanisms, namely, refined diag- and gated linear attentions, effectively alleviating computational burdens associated with unnecessary correlations between heartbeats. To address rhythmic and beat-pattern arrhythmias, we used two refined transformer models with a collaborative block, leveraging coarse- and fine-grained tokens to capture inter- and intra-heartbeat correlations. The collaborative block between two models facilitates the exchange of rhythm information, thereby improving the accuracy of beat detection. On the MIT-BIH dataset, our refined attentions yield over a 65% reduction in computational efforts compared with conventional self-attention. Notably, our refined transformer models achieve 96% accuracy for rhythmic detection and rank within the top two performers for all types of heartbeat detection. Moreover, the collaborative block enhances the recall by 8.8% and precision by 3.4% for atrial premature detection.