Skip to main content

Unlimited 10-sec 8-leads Deep Fake ECG generator.

Project description

deepfake-ecg

Paper | GitHub | Pre-generated ECGs (150k)

Generate unlimited realistic deepfake ECGs using the deep generative model:Pulse2pulse introduced in our full paper here: https://doi.org/10.1101/2021.04.27.21256189 (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{ecg-pulse2pulse,
	author = {Thambawita, Vajira Lasantha and Isaksen, Jonas L and Hicks, Steven and Ghouse, Jonas and Ahlberg, Gustav and Linneberg, Allan and Grarup, Niels and Ellervik, Christina and Olesen, Morten Salling and Hansen, Torben and Graff, Claus and Holstein-Rathlou, Niels-Henrik and Str{\"u}mke, Inga and Hammer, Hugo L. and Maleckar, Mary M and Halvorsen, P{\aa}l and Riegler, Michael A. and Kanters, J{\o}rgen K.},
	doi = {10.1101/2021.04.27.21256189},
	elocation-id = {2021.04.27.21256189},
	journal = {medRxiv},
	publisher = {Cold Spring Harbor Laboratory Press},
	title = {DeepFake electrocardiograms: the key for open science for artificial intelligence in medicine},
	url = {https://doi.org/10.1101/2021.04.27.21256189},
	year = {2021}
}

License

MIT

For more details:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepfake-ecg-1.1.2.tar.gz (39.4 MB view details)

Uploaded Source

Built Distribution

deepfake_ecg-1.1.2-py3-none-any.whl (39.4 MB view details)

Uploaded Python 3

File details

Details for the file deepfake-ecg-1.1.2.tar.gz.

File metadata

  • Download URL: deepfake-ecg-1.1.2.tar.gz
  • Upload date:
  • Size: 39.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.2

File hashes

Hashes for deepfake-ecg-1.1.2.tar.gz
Algorithm Hash digest
SHA256 490f63705acb167c3ecf02f5a83e9147b844b9d1643e2b4ba00fa1c48281cfa0
MD5 a8017d0ea07c9d2e698d6fb161a17ed9
BLAKE2b-256 5737b923e8d863a30e859a1d4bacb93a4f5328c025dd6494b3ad68854befd647

See more details on using hashes here.

File details

Details for the file deepfake_ecg-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: deepfake_ecg-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 39.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.2

File hashes

Hashes for deepfake_ecg-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dff913de571f9d92d95e25eed4a3fe7df0bfee7c66315ba1fa0687acdd11649c
MD5 90e915b211a8f9503e9db22c2bf03769
BLAKE2b-256 36d406f4457cafcb4d3e57c5c98bc1a2a82ff0feac66286cd63ca3ad88c1d446

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page