Downloads · 30 days
2.8K
76% of all-time downloads
ghirani33/ecgfounder-onnx
ecgfounder-onnx is a machine learning model from ghirani33. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for onnx. The card lists the license as mit.
ONNX-converted ECGFounder foundation models for real-time 12-lead ECG interpretation on edge hardware. Optimized for deployment on ARM processors (Raspberry Pi 4) and x86-64 systems.
Downloads · 30 days
2.8K
76% of all-time downloads
All-time downloads
3.7K
Public
Repo size
247 MB
Likes
0
Public
Click a slice to open those files.
.onnx247 MB · 100%
From the Hugging Face model README
ONNX-converted ECGFounder foundation models for real-time 12-lead ECG interpretation on edge hardware. Optimized for deployment on ARM processors (Raspberry Pi 4) and x86-64 systems.
Performance: Macro AUROC 0.909 (PTB-XL test set, n=2,163) | Latency 115 ms (Raspberry Pi 4)
import onnxruntime as ort
import numpy as np
# Load model
session = ort.InferenceSession("ecg_founder_all71.onnx")
# Prepare input: 12 leads × 5000 samples (10 seconds @ 500 Hz)
ecg_signal = np.random.randn(1, 12, 5000).astype(np.float32)
# Inference
logits = session.run(None, {"input": ecg_signal})[0]
# Convert to probabilities
probabilities = 1 / (1 + np.exp(-logits)) # Sigmoid
# Get top 5 predictions
top5_indices = np.argsort(probabilities[0])[-5:][::-1]
print("Top 5 diagnoses:", top5_indices)
labels_all71.json| Parameter | Value |
|---|---|
| Format | Float32 numpy array |
| Shape | (batch_size, 12, 5000) |
| Leads | I, II, III, aVR, aVL, aVF, V1, V2, V3, V4, V5, V6 |
| Sampling rate | 500 Hz (required) |
| Duration | 10 seconds (5,000 samples) |
| Preprocessing | Bandpass filter (0.5-50 Hz) + Z-score normalization |
| Important | Raw digital ECG signals only (not scanned paper ECG images) |
| Platform | CPU | Latency | Validated AUROC |
|---|---|---|---|
| Raspberry Pi 4 | ARM Cortex-A72 @ 1.5 GHz | 115 ms | 0.909 (95% CI: 0.906-0.912) |
| x86-64 Desktop | Intel Core i7-10700K @ 3.8 GHz | 57 ms | 0.909 (95% CI: 0.906-0.912) |
GitHub Repository: https://github.com/GhIrani33/ecgfounder-edge-cds
The repository includes:
from huggingface_hub import hf_hub_download
# Download 71-class model
model_path = hf_hub_download(
repo_id="ghirani33/ecgfounder-onnx",
filename="ecg_founder_all71.onnx"
)
# Download labels
labels_path = hf_hub_download(
repo_id="ghirani33/ecgfounder-onnx",
filename="labels_all71.json"
)
Download files directly from the "Files and versions" tab above.
Dataset: PTB-XL fold 10 (n=2,163 independent test samples)
Metric: Macro-averaged AUROC across 71 diagnostic classes
Result: 0.909 (95% CI: [0.906, 0.912])
Per-class performance (selected examples):
Noise robustness:
See GitHub repository for complete validation metrics and methodology.
If you use these models in your research, please cite:
@software{ecgfounder_onnx_2025,
title={ECGFounder ONNX Models for Edge-Based Clinical Decision Support},
author={Dolatkhah Laein, Ghasem},
year={2025},
url={https://huggingface.co/ghirani33/ecgfounder-onnx},
note={ONNX deployment of ECGFounder foundation model}
}
Original ECGFounder paper:
@article{li2024ecgfounder,
title={An Electrocardiogram Foundation Model Built on over 10 Million Recordings with External Evaluation across Multiple Domains},
author={Li, Qihan and others},
journal={NEJM AI},
volume={1},
number={7},
year={2024}
}
PTB-XL dataset:
@article{wagner2020ptbxl,
title={PTB-XL, a large publicly available electrocardiography dataset},
author={Wagner, Patrick and others},
journal={Scientific Data},
volume={7},
number={1},
pages={154},
year={2020}
}
Research prototype. These models have been validated on benchmark datasets (PTB-XL) but are NOT FDA/CE approved and must NOT be used for primary clinical diagnosis without:
Intended use: Research, algorithm development, and proof-of-concept demonstrations for clinical decision support systems.
MIT License. See LICENSE file for details.
Note: ECGFounder original model weights are subject to their original license terms. This repository provides ONNX-converted models for deployment research.
Maintainer: Ghasem Dolatkhah Laein
Email: [email protected]
GitHub: GhIrani33/ecgfounder-edge-cds
For questions about the original ECGFounder model, please contact the original authors.