Background
The electrocardiogram (ECG) is the primary method for diagnosing atrial fibrillation (AF), but interpreting ECGs can be time-consuming and labor-intensive, which deserves more exploration.
Methods
We collected ECG data from 6,590 patients as YY2023, classified as Normal, AF, and Other. Convolutional Neural Network (CNN), bidirectional Long Short-Term Memory (BiLSTM), and Attention construct the AF recognition model CNN BiLSTM Attention-Atrial Fibrillation (CLA-AF). The generalization ability of the model is validated on public datasets CPSC2018, PhysioNet2017, and PTB-XL, and we explored the performance of oversampling, resampling, and hybrid datasets. Finally, additional PhysioNet2021 was added to validate the robustness and applicability in different clinical settings. We employed the SHAP method to interpret the model's predictions.
Results
The F1-score, Precision, and AUC of the CLA-AF model on YY2023 are 0.956, 0.970, and 1.00, respectively. Similarly, the AUC on CPSC2018, PhysioNet2017, and PTB-XL reached above 0.95, demonstrating its strong generalization ability. After oversampling PhysioNet2017, F1-score and Recall improved by 0.156 and 0.260. Generalization ability varied with sampling frequency. The model trained from the hybrid dataset has the most robust generalization ability, achieving an AUC of 0.96 or more. The AUC of PhysioNet2021 is 1.00, which proves the applicability of CLA-AF. The SHAP values visualization results demonstrate that the model's interpretation of AF aligns with the diagnostic criteria of AF.
Conclusions
The CLA-AF model demonstrates a high accuracy in recognizing AF from ECG, exhibiting remarkable applicability and robustness in diverse clinical settings.