Deep Learning Approach for Detection of Atrial Fibrillation and Atrial Flutter Based on ECG Images

  • Estela Ribeiro USP
  • Felipe M. Dias USP
  • Quenaz B. Soares USP
  • Jose E. Krieger USP
  • Marco A. Gutierrez USP


This study explores the application of image-based deep learning techniques to distinguish between Atrial Fibrillation (AFib) and Atrial Flutter (AFlut) using images of standard 12-lead ECG exams from a private database. By implementing a MobileNet Convolutional Neural Network architecture, we achieve a high classification performance, with an accuracy of 95.6%, AUROC of 97.6%, F1-score of 83.2%, specificity of 99.6%, and sensitivity of 72.7%. We also applied explainable methods, such as Grad-CAM and LIME, to try to interpret the model’s decision-making process and identify significant regions within the ECG images that contribute to the classification. Our results demonstrate the potential of image-based deep learning approaches for accurate and reliable discrimination between AFib and AFlut, paving the way for enhanced diagnostic capabilities in clinical settings.


Brundel, B. J. J. M., Ai, X., Hills, M. T., Kuipers, M. F., Lip, G. Y. H., and de Groot, N. M. S. (2022). Atrial fibrillation. Nature Reviews Disease Primers, 21(8).

Cosío, F. G. (2017). Atrial flutter, Typical and Atypical: A review. Arrhythmia Electrophysiology Review, 6(2):55–62.

Dias, F. M., Samesima, N., Ribeiro, A., Moreno, R. A., Pastore, C. A., Krieger, J. E., and Gutierrez, M. A. (2021). 2d image-based atrial fibrillation classification. In 2021 Computing in Cardiology (CinC), volume 48, pages 1–4.

Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., Mietus, J., Moody, G., Peng, C., and Stanley, H. E. (2000). Physiobank, physiotoolkit, and physionet: Components of a new research resource for complex physiologic signals. Circulation [Online], 101(23):e215–e220.

Hicks, S. A., Isaksen, J. L., Thambawita, V., Ghouse, J., Ahlberg, G., Linneberg, A., Grarup, N., Strümke, I., Ellervik, C., Olesen, M. S., Hansen, T., Graff, C., Holstein-Rathlou, N.-H., Halvorsen, P., Maleckar, M. M., Riegler, M. A., and Kanters, J. K. (2021). Explaining deep neural networks for knowledge discovery in electrocardiogram analysis. Scientific Reports, 11(1):10949.

Howard, A. G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., and Adam, H. (2017). Mobilenets: Efficient convolutional neural networks for mobile vision applications.

Ivanovic, M. D., Atanasoski, V., Shvilkin, A., Hadzievski, L., and Maluckov, A. (2019). Deep learning approach for highly specific atrial fibrillation and flutter detection based on rr intervals. In 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pages 1780–1783.

Ko Ko, N. L., Sriramoju, A., Khetarpal, B. K., and Srivathsan, K. (2022). Atypical atrial flutter: review of mechanisms, advances in mapping and ablation outcomes. Current Opinion in Cardiology, 37(1):36–45.

Moody, G. B. and Mark, R. G. (1983). A new method for detecting atrial fibrillation using r-r intervals. Computers in Cardiology, 10:227–230.

Ribeiro, M. T., Singh, S., and Guestrin, C. (2016). ”why should i trust you?”: Explaining the predictions of any classifier. arXiv: 1602.04938.

Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., and Batra, D. (2017). Grad-cam: Visual explanations from deep networks via gradient-based localization. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 618–626.

Shah, S. R., Luu, S.-W., Calestino, M., David, J., and Bray, C. (2018). Management of atrial fibrillation-flutter: uptodate guideline paper on the current evidence. Journal of Community Hospital Internal Medicine Perspectives, 8(5):269–275.

Thaler, M. S. (2019). The Only EKG Book You’ll Ever Need. Philadelphia :Wolters Kluwer Health/Lippincott Williams Wilkins.

Wegner, F. K., Plagwitz, L., Doldi, C., Willy, K., Wolfes, J., Sandmann, S., Varghese, J., and Eckardt, L. (2022). Machine learning in the detection and management of atrial fibrillation. Clinical Research in Cardiology, 111(9):1010–1017.
RIBEIRO, Estela; DIAS, Felipe M.; SOARES, Quenaz B.; KRIEGER, Jose E.; GUTIERREZ, Marco A.. Deep Learning Approach for Detection of Atrial Fibrillation and Atrial Flutter Based on ECG Images. In: SIMPÓSIO BRASILEIRO DE COMPUTAÇÃO APLICADA À SAÚDE (SBCAS), 23. , 2023, São Paulo/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 509-514. ISSN 2763-8952. DOI: