Electrode Reversal Robustness of Deep Learning Classifiers for ECG Diagnosis
Assad H. Thary Al-Ghrairi
¹Department of Computer Science, College of Science, Al-Nahrain University, Jadriya, Baghdad, 10001, Iraq,
Download PDF
http://doi.org/10.37648/ijps.v22i01.008
Abstract
Swapped limb electrodes are a common technical error in electrocardiography, estimated at about 4% of acute care recordings. Deep learning classifiers now read ECGs automatically, but nobody has measured how often their diagnoses change when the electrodes are swapped, or which defense protects the diagnosis best. We used the public PTB XL dataset (21,388 labeled 12 lead ECGs) with its official training, validation and test folds and five diagnostic super classes. Because every limb lead is a fixed combination of three electrode potentials, all five swaps of the right arm, left arm and left leg electrodes can be computed exactly from real recordings, while the chest leads stay unchanged. We trained a 1D residual network and three defenses: swap augmentation, a swap detector followed by exact correction, and a multitask network that diagnoses and detects the swap together. Each model was trained with three seeds. Three hypotheses were written down before the full run. On correctly recorded test ECGs (2,158 recordings from 1,877 patients), the baseline reached a macro AUROC of 0.923. Averaged over the five swaps, it fell to 0.732 (difference 0.191, 95% CI 0.183 to 0.199) and changed the predicted diagnosis set of 78% of ECGs. After a right arm and left leg swap, 99.7% of ECGs without infarction that had been read correctly were newly called myocardial infarction. Detection followed by correction restored a swap averaged AUROC of 0.923, changed only 0.18% of diagnoses and created no new infarction calls. The detector identified the correct condition in 99.1% of cases, and 92% of its few errors confused conditions that differ only by the left arm and left leg electrodes. Swap augmentation and the multitask network also preserved AUROC (0.919 and 0.922) but still changed 15% and 19% of diagnoses. No defense reduced accuracy on correctly recorded ECGs. All three hypotheses were supported (adjusted p = 0.003). Standard deep learning ECG classifiers are highly vulnerable to limb electrode swaps, and the error most often looks like a myocardial infarction. Detecting the swap and undoing it exactly protects the diagnosis almost completely and also tells the user that the recording needs attention.
Keywords:
Electrocardiography; Deep Learning; Electrode Reversal; Limb Lead Swap; Robustness; Myocardial Infarction; PTB XL
