ECG Cardiovascular Disease Classification
Multi-label classification of 5 cardiovascular superclasses (NORM, MI, STTC, CD, HYP) from 12-lead ECG recordings, trained on PTB-XL.
Deployed model: CNN (noaug training variant)
Files
ecg_model.keras| trained modelnormalisation_params.npz| per-channel mean and std (z-score, from training fold)thresholds.json| per-class decision thresholds optimised on the validation fold
Usage
import keras, numpy as np, json
from huggingface_hub import hf_hub_download
model = keras.saving.load_model(
hf_hub_download("Steenslid/ecg-ptbxl-classification", "ecg_model.keras"))
params = np.load(hf_hub_download("Steenslid/ecg-ptbxl-classification", "normalisation_params.npz"))
with open(hf_hub_download("Steenslid/ecg-ptbxl-classification", "thresholds.json")) as f:
thresholds = json.load(f)
# Input x: (1000, 12) float32 ECG in mV, 100 Hz, standard 12-lead order
x_norm = (x - params["mean"]) / params["std"]
probs = model.predict(x_norm[np.newaxis])[0]
preds = {sc: probs[i] >= thresholds[sc] for i, sc in enumerate(
["NORM","MI","STTC","CD","HYP"])}
Authors: Edvard Vindenes Steenslid & Morten Kvamme
- Downloads last month
- 282
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support