vlbthambawita / deepfake-ecg

Generate unlimited realistic deepfake ECGs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deepfake-ecg


If you want to train the model from scratch, please refere our development repository Pulse2Pulse.


Generate unlimited realistic deepfake ECGs using the deep generative model:Pulse2pulse introduced in our full paper here: https://doi.org/10.1038/s41598-021-01295-2 (DeepFake electrocardiograms: the key for open science for artificial intelligence in medicine)

Installation

Use the package manager pip to install deepfake-ecg generator.

pip install deepfake-ecg

Usage

The generator functions can generate DeepFake ECGs with 8-lead values [lead names from first coloum to eighth colum: 'I','II','V1','V2','V3','V4','V5','V6'] for 10s (5000 values per lead). These 8-leads format can be converted to 12-leads format using the following equations.

lead III value = (lead II value) - (lead I value)
lead aVR value = -0.5*(lead I value + lead II value)
lead aVL value = lead I value - 0.5 * lead II value
lead aVF value = lead II value - 0.5 * lead I value

Run on CPU (default setting)

import deepfakeecg

#deepfakeecg.generate("number of ECG to generate", "Path to generate", "start file ids from this number", "device to run") 

deepfakeecg.generate(5, ".", start_id=0, run_device="cpu") # Generate 5 ECGs to the current folder starting from id=0

Run on GPU

import deepfakeecg

#deepfakeecg.generate("number of ECG to generate", "Path to generate", "start file ids from this number", "device to run") 

deepfakeecg.generate(5, ".", start_id=0, run_device="cuda") # Generate 5 ECGs to the current folder starting from id=0

Pre-generated DeepFake ECGs and corresponding MUSE reports are here: https://osf.io/6hved/

- In this repository, there are two DeepFake datasets:
    1. 150k dataset - Randomly generated 150k DeepFakeECGs
    2. Filtered all normals dataset - Only "Normal" ECGs filtered using the MUSE analysis report

A real ECG vs a DeepFake ECG (from left to right):

GitHub Logo

A sample DeepFake ECG:

GitHub Logo

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Citation:

@article{thambawita2021deepfake,
  title={DeepFake electrocardiograms using generative adversarial networks are the beginning of the end for privacy issues in medicine},
  author={Thambawita, Vajira and Isaksen, Jonas L and Hicks, Steven A and Ghouse, Jonas and Ahlberg, Gustav and Linneberg, Allan and Grarup, Niels and Ellervik, Christina and Olesen, Morten Salling and Hansen, Torben and others},
  journal={Scientific reports},
  volume={11},
  number={1},
  pages={1--8},
  year={2021},
  publisher={Nature Publishing Group}
}	

License

MIT

For more details:

Please contact: vajira@simula.no, michael@simula.no

About

Generate unlimited realistic deepfake ECGs.

License:MIT License


Languages

Language:Python 100.0%