---
title: 'PTB-XL: ECG Benchmark Dataset'
url: https://www.emergentmind.com/topics/ptb-xl-dataset
type: topic
---

# PTB-XL: ECG Benchmark Dataset

The PTB-XL dataset is a large-scale, open-access corpus of clinical 12-lead electrocardiogram (ECG) recordings designed for benchmarking and research in automated ECG interpretation. It provides structured ground-truth labels, comprehensive metadata, and a well-defined experimental framework facilitating rigorous development and evaluation of machine learning algorithms in electrophysiological signal analysis [2004.13701][2504.16101][2209.00989].

## 1. Data Composition and Annotation Structure

PTB-XL comprises 21,837 12-lead ECG records, each 10 seconds in duration, acquired from 18,885 unique patients (52% male, 48% female). The recordings are provided at both 500 Hz (raw) and 100 Hz (recommended for modeling) sample rates. The standard clinical lead configuration is used: I, II, III, aVR, aVL, aVF, V1–V6. Diagnostic labeling follows the SCP-ECG standard with 71 non-mutually-exclusive statement codes, divided into three major categories:

- **Diagnosis:** 44 statements (including myocardial infarction [MI], hypertrophy [HYP], conduction disturbance [CD])
- **Form:** 19 statements (waveform morphology)
- **Rhythm:** 12 statements (e.g., atrial fibrillation, pacemaker rhythm)

Diagnosis labels are further structured hierarchically into 5 superclasses and 24 subclasses. The five superclasses—Normal (NORM), Conduction Disturbance (CD), Hypertrophy (HYP), Myocardial Infarction (MI), and ST/T-Change (STTC)—map most common high-level diagnoses for multi-label tasks [2504.16101][2004.13701][2209.00989]. Each record may have multiple concurrent labels reflecting clinical poly-diagnosis. Class imbalance is pronounced: for example, in [2504.16101], NORM: 7,185; CD: 3,232; HYP: 815; MI: 2,936; STTC: 3,064.

Expert cardiologists annotated each record using SCP taxonomy, with diagnosis likelihoods (15–100) via keyword mapping. Additional technical expert review labels signal quality (noise, baseline drift), supporting downstream quality filtering or artifact-aware training strategies [2004.13701].

## 2. Preprocessing and Time–Frequency Representation

PTB-XL's ECG tracings are subject to several preprocessing workflows, depending on the experimental design. For deep learning pipelines, the recommended 100 Hz downsampled signals (1,000 samples/lead, per record) are frequently used directly with minimal filtering; optional baseline-wander removal and band-pass filtering address artifactual contamination as required [2004.13701]. In [2504.16101], explicit band-pass filtering is omitted, with baseline wander and high-frequency noise handled in the frequency domain.

Advanced feature extraction is achieved using Short-Time Fourier Transform (STFT), as exemplified in [2504.16101]. Input $X \in \mathbb{R}^{T \times 12}$ (with $T=1,000$) is mapped using STFT with window length 64, hop length 16, and 480 frequency bins:
$$
X_\mathrm{STFT} = \mathrm{STFT}(X) \in \mathbb{R}^{T' \times 12 \times F}
$$
where $T' = \left\lfloor\frac{T-W}{H}\right\rfloor + 1$, with $W$ = window length, $H$ = hop length, $F$ = FFT bins.

Classic denoising approaches such as 1D low-pass FIR filtering (cutoff 45 Hz) and wavelet-based baseline correction were used in [2209.00989] for robust binary classification, particularly targeting deployment on embedded hardware.

## 3. Splitting Protocols and Experimental Workflows

Recommended experimental design relies on the predefined 10-fold cross-validation partitions with patient-level stratification to preclude overfitting and ensure generalizability [2004.13701][2504.16101][2209.00989]. The standard split allocates folds 1–8 for training (~80%), fold 9 for validation (~10%), and fold 10 as an independent test set (~10%). Each fold maintains the original distribution of diagnoses, permitting consistent benchmarking. Patient IDs are used to avoid patient overlap between splits [2004.13701].

For multi-label modeling, class imbalance is mitigated via per-class weighting in loss functions, robust data augmentation (random masking of contiguous time–frequency segments, with a mask ratio of 0.2 and application probability of 0.8 per batch in [2504.16101]), and frequency-domain artifact suppression.

## 4. Model Benchmarks and Performance Metrics

PTB-XL supports both multi-label and single-label classification tasks. Multi-label metrics include:

- **Term-centric macro-AUC:**
  $$
  \mathrm{AUC} = \frac{1}{C} \sum_{c=1}^C \mathrm{AUC}_c
  $$
  where $C$ is the number of classes.

- **Sample-centric $F_{\max}$ score:** Maximizes threshold-dependent F1 over all thresholds.

- **Sample-centric precision and recall:**
  $$
  \mathrm{pr}(\tau) = \frac{1}{N_{\tau}}\sum_{i\in\mathcal{N}_\tau} \frac{|\{f\in P_i(\tau)\cap T_i\}|}{|P_i(\tau)|}, \quad
  \mathrm{rc}(\tau) = \frac{1}{N}\sum_{i=1}^{N} \frac{|\{f\in P_i(\tau)\cap T_i\}|}{|T_i|}
  $$
  $P_i(\tau)$: predicted labels at threshold $\tau$ for sample $i$; $T_i$: true labels.

Single-label tasks (e.g., binary classification, age/gender) use accuracy, precision, recall, F1, and mean absolute error for regression endpoints.

A range of modeling architectures have been evaluated:

| Task/Labels      | Top Models           | Term-AUC | $F_{\max}$ |
|------------------|---------------------|----------|------------|
| All (71)         | XResNet101/IncTime  | 0.925    | 0.764      |
| Diagn. (44)      | ResNet1d/XResNet101 | 0.936    | 0.741      |
| Super (5)        | ResNet1d/XResNet101 | 0.930    | 0.823      |
| Rhythm (12)      | XResNet101/IncTime  | 0.957    | 0.917      |

Convolutional and recurrent models (e.g., ResNet1d, InceptionTime, LSTM, xLSTM) consistently outperform feature-based or naive predictors [2004.13701][2504.16101].

## 5. Specialized Applications and Deployment Scenarios

PTB-XL's scale, diversity, and annotation granularity permit experimentation across a range of clinical and technical tasks. In [2209.00989], a 1D-CNN trained for binary “Normal vs. Abnormal” classification was quantized and deployed on Raspberry Pi, achieving accuracy of 81.2% (12 leads) with floating-point TFLite models, and model size reductions of 86–94% (float32 to float16 conversion). Class weights (NORM 1.192, Abnormal 0.861) counteracted label imbalance. Performance scaled positively with lead count, with 12-lead input providing maximal accuracy.

The dataset also supports transfer learning workflows, with pretraining on PTB-XL followed by adaptation to other ECG datasets (e.g., ICBEB2018), though substantial benefits arise only in limited-target-data regimes [2004.13701].

## 6. Advanced Analytic Methods and Interpretability

PTB-XL's rich annotation facilitates interpretability analyses, model calibration, and stratified performance assessment:

- **Hidden stratification:** Fine-grained evaluation reveals subgroup performance deficits potentially masked by aggregate metrics (e.g., IVCD with low AUC within NORM co-diagnosis group [2004.13701]).
- **Model uncertainty:** Deep ensembles quantify predictive variance, aligning with annotator likelihoods and flagging possible human overconfidence at maximal certainty labels.
- **Interpretability:** Layer-wise relevance propagation and gradient-based saliency maps elucidate the model's decision basis for specific pathologies.

These capabilities enable the development of clinically robust and explainable ECG classifiers.

## 7. Practical Guidelines and Research Impact

The PTB-XL dataset constitutes a primary resource for reproducible ECG machine learning research. Key recommendations for researchers include:

- Adopt patient-stratified cross-validation exclusively.
- Report both term-centric macro-AUC and sample-centric $F_{\max}$ with confidence intervals (e.g., bootstrapping).
- Prefer 100 Hz signals for direct input; apply only necessary preprocessing.
- Deploy data augmentation (windowing, time–frequency masking) for regularization.
- Address label imbalance with weighted losses and systematic augmentation strategies.
- Leverage metadata and artifact labels for robust model development.

By providing comprehensive, structured ground-truth for ECG signal interpretation, PTB-XL has established itself as a central benchmark for the development, comparison, and deployment of deep learning methods in clinical cardiology and digital health [2004.13701][2504.16101][2209.00989].

Source: https://www.emergentmind.com/topics/ptb-xl-dataset