fmeneguiPTEN
← All projects

ECG image classification · 2024

PhysioNet Challenge 2024

Heart Institute (InCor), Hospital das Clínicas, University of São Paulo Medical School

ECG image research at InCor

When the 2024 topic was announced, I was already studying ECG image classification during my PhD at the University of São Paulo and InCor. Many hospital ECGs were stored as images, while most models expected time-series signals. That mismatch was central to my research.

I led AIMED in the challenge. We used what I had already tested during my PhD to choose the training strategy. The organizers then evaluated our code on unseen data. We finished first in classification.

Felipe Dias and Marco Antônio Gutierrez receiving the PhysioNet Challenge 2024 classification award, with Matthew Reyna and Gari Clifford.
Award presentation at Computing in Cardiology 2024 in Karlsruhe, Germany. From left to right: Matthew Reyna, Felipe Dias, Marco Antônio Gutierrez and Gari Clifford. Photo: SBIS.

What is the PhysioNet Challenge?

The PhysioNet Challenge is an annual research competition organized by PhysioNet and Computing in Cardiology since 2000. Each year, teams work on the same clinical or physiological problem. The organizers provide the data and evaluation rules, test the algorithms and make the code available so other researchers can study and reproduce the methods.

The 2024 problem: ECGs on paper

The 2024 topic was Digitization and Classification of ECG Images. There were two tasks, with separate awards. Teams could enter either task or both:

Digitization
Reconstruct the lead time series from an image of the ECG.
Classification
Identify ECG categories from the image, either directly or using reconstructed signals.

Teams submitted their code, and the organizers ran the training and evaluation. Each team selected a final version for testing on hidden data. We focused on classifying the images directly.

Why we chose to classify the image

Digitizing an ECG means recovering the signal from the image. It involves separating each lead from the grid, recovering the time and amplitude scales, and dealing with overlapping traces, shadows, perspective and noise. Errors can carry through to the classifier that uses the reconstructed signal.

I had already tested CNNs for ECG image classification, so we decided to focus on that task. The model analyzes the image directly, without first reconstructing the signal.

Doctoral experiments

During my PhD, I used synthetic images generated from public ECG signals and real ECGs from InCor's outpatient and emergency departments. I compared ConvNeXt, EfficientNet-B3, ResNet50, ViT and Swin Transformer, and tested different ways to train them.

  • I tested data augmentation and different image resolutions.
  • I compared ImageNet initialization, ECG pretraining and the combination of both.
  • I tested adding age and sex, and using a loss function that combined BCE and MCC.
  • I ran ablation studies to assess individual choices, and tested the models on photographed and scanned ECGs.

Our challenge entry built on some of these experiments. The training strategy we submitted is outlined below.

Pretraining

We started with ImageNet weights, but ECGs look very different from the photographs in that dataset. Before fine-tuning for the challenge, we trained the network on synthetic and real ECG images.

In my thesis, I also tested random initialization followed by ECG-only pretraining. Macro F1 was lower than with ImageNet initialization. Combining ImageNet initialization with ECG pretraining gave the best result among the three configurations below. We used that combination in the competition.

Initialization and pretrainingMacro F1
ImageNet, without ECG-specific pretraining0.737
Random weights + ECG pretraining0.565
ImageNet + ECG pretraining0.759

Thesis ablation results from 10-fold cross-validation on InCor-EMG. The PhysioNet Challenge evaluation appears in the results section. Doctoral thesis, including Appendix A on the challenge.

Published method

Our paper, Image-Based Electrocardiogram Classification Using Pre-trained ConvNext, describes the training strategy we used in the challenge:

Figure 1 from the CinC 2024 paper: ImageNet weights, pretraining on CODE15 and InCor-AMB, fine-tuning on InCor-EMG and final fine-tuning on PTB-XL with five folds.
AIMED’s final method, reproduced from Figure 1 of the CinC 2024 paper.
  1. ImageNet

    We started with a ConvNeXt pretrained on general images.

  2. CODE15 and InCor-AMB

    We adapted the network to synthetic images generated with ECG-Image-Kit and real outpatient ECGs.

  3. InCor-EMG

    We performed an additional fine-tuning stage on emergency ECG images.

  4. PTB-XL

    We fine-tuned for the 11 challenge categories using 5-fold cross-validation and combined the five models into an ensemble.

We used grayscale images at 224 × 224 resolution for pretraining and 384 × 384 for final fine-tuning. Training included data augmentation, AdamW, class-weighted BCE and early stopping. The 11 categories covered normal ECGs, infarction, ST/T changes, conduction disturbances and arrhythmias.

We left CINC21 out of pretraining because it contains PTB-XL. We also reduced cross-validation from 10 to 5 folds to stay within the challenge computing limits.

Code and models

I reorganized the AIMED code into a public repository with tutorials for installation, inference and training, plus a manifest of the weights and inference configuration.

View AIMED code and documentation on GitHub

First place: team AIMED

AIMED finished first among the 16 official classification entries, with a macro F1 of 0.817. These were the top three results published by the organizers:

RankTeamRanking macro F1
1stAIMED0.817
2ndInventec AIC0.742
3rdBAPORLab0.730

View the official classification score table

The ranking was based on color and black-and-white scans of paper ECGs. The extended evaluation also tested phone photos, stained or damaged paper and monitor screenshots. Our average score across the eight scenarios was 0.733. Scores were lower on photographs.

PhysioNet Challenge 2024 certificate: first place in classification for team AIMED, naming Felipe M. Dias, Estela Ribeiro, Quenaz B. Soares, José E. Krieger and Marco A. Gutierrez.
First-place classification certificate, team AIMED. Karlsruhe, September 11, 2024.

Team

I led AIMED and was the paper's first author. The team included Estela Ribeiro, Quenaz B. Soares, José E. Krieger and Marco A. Gutierrez at InCor's Biomedical Informatics Laboratory. Foxconn Brazil and the Zerbini Foundation supported the work.

News coverage

  • Saúde Business · October 15, 2024

    Article by Juliana Santos.

  • IT Portal · October 16, 2024

    Report based on information from InCor.

  • PPTA Saúde · October 16, 2024

    Republication of the Saúde Business article.

SBIS announcement

The Brazilian Society of Health Informatics published an article by Marco A. Gutierrez about the award on October 8, 2024.

Read the SBIS announcement

Previous editions

Topics from the 2016 to 2023 editions:

YearTopic
2023Neurological recovery from coma after cardiac arrest
2022Heart murmur detection from phonocardiograms
2021ECG classification with different lead counts
2020Classification of 12-lead ECGs
2019Early prediction of sepsis
2018Arousal detection in sleep studies
2017Atrial fibrillation in short single-lead ECGs
2016Normal and abnormal heart sound classification

Explore the complete history since 2000

Paper and sources

  1. Dias FM et al. Exploring the limitations of blood pressure estimation using the photoplethysmography signal. Physiological Measurement, 2025.
  2. Moreno R, Dias F, Arruda M et al. IoT Medical Device Architecture to Estimate Non-invasive Arterial Blood Pressure. Symposium on Internet of Things (SIoT), 2022.

Contact

f.meneguittidias@gmail.com

Portfolio (PDF)

Search