Transformer-Based Deep Learning Approach for the Digitization and Classification of Physical ECG Paper Images

Mohanad Alkhodari, Mostafa Mohamed Moussa, Leontios J. Hadjileontiadis, Ahsan Khandoker
Khalifa University


Abstract

Introduction: Electrocardiography (ECG) is an essential tool for understanding the electrophysiology of the heart and its electrical activity in response to cardiovascular diseases (CVD). However, it is still widely used as a physical paper-based format which poses difficulties in presence of billions of patients' data; reducing its global accessibility in cardiac care. Methods: Here, we propose a novel deep learning approach to digitize physical ECGs (images or papers) and classify the CVD condition (normal or abnormal) using a convolutional neural network (CNN) embedded with the most recent attention mechanism. The approach starts by pre-processing the images to remove the background grid included in papers. The digitization part involves the identification of the PQRT waveform and the horizontal alignment with the grid lines. On the other hand, the CNN part incudes a multi-head attention and feed-forward blocks to train on transformer-encoded features. Results: Our team, VitalRhythms, achieved a challenge classification score (F-measure) of 0.694 during the unofficial phase and an overall 10-fold cross-validation score of 0.766. Moreover, the reconstruction score (SNR) was -18.10 with a 10-fold cross validation of -13.20. Conclusion: This study paves the way towards implementing sophisticated deep learning tools for the purpose of digitizing paper-based ECGs and aiding the assessment of CVDs and thus, simplifying clinical cardiac care in presences of big patient data.