Kardio-Net: A Deep Learning Model for Predicting Serum Potassium Levels from Apple Watch ECG in ESRD Patients

I. Input preparation

  1. Prerequisites

    Ensure that all ECG files are saved in *.npy format with the following shapes:

    • (5000, 12) for 12-lead ECGs
    • (500 * 30 seconds, 1) for Apple Watch ECGs

    Store these files in a single flat directory, and include a manifest CSV file in the same location to accompany them.

  2. Manifest File Format

    The manifest CSV file should include a header. Each row corresponds to one ECG file with the following columns:

    • filename: Name of the .npy file (without the extension).
    • label: serum potassium label.

II. Inference

For 12-Lead ECG

  1. use predict_potassium_12lead.py to get the potassium level prediction.

  2. Edit data_path and manifest_path and run the predict_potassium.py script.

  3. Upon completion, a file named "dataloader_0_predictions.csv" will be saved in the same directory. This file contains the inference results "preds" from the model.

  4. Use generate_result.py to get the performance metric and figure.

For Single Lead / Apple Watch ECG

A. ECG preprocessing and segmentation

  1. Use preprocessing.py for denoise, normalize, and segment ECG into 5-second for input

  2. Set the following paths in preprocessing.py:

    • raw_directory = "path/to/raw_data_directory" #raw ecg folder for target task
    • output_directory = "path/to/output_directory" #output folder for normalize ECG
    • manifest_path = "/path/to/manifest.csv" # Manifest file path
    • output_path = "path/to/output_path" # Output path for segmented ECGs
  3. Execute predict.py.

  4. If the ECG files were already normalize, can execute the segmentation function only.

B. potassium regression model

  1. use predict_potassium_1lead.py to get the potassium level prediction.

  2. Edit data_path and manifest_path and run the predict_potassium.py script.

  3. Upon completion, a file named "dataloader_0_predictions.csv" will be saved in the same directory. This file contains the inference results "preds" from the model.

  4. Use generate_result.py to get the performance metric and figure.

Paper Link: https://www.sciencedirect.com/science/article/pii/S2405500X24007527

Citation: I-Min Chiu, Po-Jung Wu, Huan Zhang, J. Weston Hughes, Albert J. Rogers, Laleh Jalilian, Marco Perez, Chun-Hung Richard Lin, Chien-Te Lee, James Zou, David Ouyang, Serum Potassium Monitoring Using AI-Enabled Smartwatch Electrocardiograms, JACC: Clinical Electrophysiology, 2024, ISSN 2405-500X, https://doi.org/10.1016/j.jacep.2024.07.023.


Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.