Deep learning-based multitask model for 12-lead electrocardiogram delineation, rhythm analysis, and median beat construction
European Heart Journal - Digital Health

Abstract
Accurate delineation and classification of the P-, QRS- and T-wave underpin virtually every electrocardiographic diagnosis. Traditional ECG analysis systems use rule-based algorithms and often struggle with noisy or abnormal signals. Recent deep learning approaches have improved performance, but many available tools, both commercial and open source, remain limited in accuracy, scope or interpretability.
To develop and evaluate a deep learning algorithm for simultaneous ECG waveform delineation, beat classification, and median beat construction in 12-lead resting ECGs.
We curated 12-lead ECGs from a Dutch academic hospital for development and internal testing. Each time point was labelled with onset, offset and wave type, together with five P-wave and fourteen QRS-wave rhythm classes. A DeepLabV3-based deep neural network with multi-class classifier was trained to output P, QRS, and T wave delineation, classification, and a median beat for each lead based solely on the dominant beat morphology. Delineation performance was assessed internally and externally on the Common Standards for Electrocardiography database using mean absolute error ± standard deviation for delineation, classification was assess internally using accuracy.
The development cohort consisted of 2,339 ECGs. The internal test set included 996 ECGs, and the external test set comprised 100 ECGs, each dataset containing records from distinct patients. External test set mean errors were 8.9 ± 7.3 ms (P duration), 2.7 ± 6.5 ms (PR), 2.6 ± 5.5 ms (QRS), and 6.1 ± 8.8 ms (QT), comparable to internal mean errors. Beat-type classification accuracy reached 96.2% overall on the internal test set. Individual class accuracies ranged from 69 % (QRS-PAC) to 100 % (QRS-AF).
Our single-network, multi-task approach achieved sub-10 ms median errors for all conduction intervals and high beat-classification accuracy. The sample-level wave masks make results visually traceable, allowing users to see exactly where an abnormality is detected, enhancing interpretability. By unifying delineation, rhythm labelling, and median-beat generation, the model could streamline clinical ECG interpretation and facilitate downstream deep learning applications. Lead I example from 3 12-lead ECGs Internal and external test results

