File size: 2,641 Bytes
354666e
 
 
 
 
 
 
3694ae0
354666e
5438002
 
 
 
 
 
 
67b1fcb
2473582
e1cd9c3
cf6bdae
e1cd9c3
67b1fcb
5438002
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d9746e
5438002
 
a939449
5438002
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3694ae0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
license: bsd
language:
- en
tags:
- ECG
- Synthetic ECG
pipeline_tag: text2text-generation
---

# deepfake-ecg

[Paper](https://www.nature.com/articles/s41598-021-01295-2) | [GitHub](https://github.com/vlbthambawita/deepfake-ecg) | [Pre-generated ECGs (150k)](https://osf.io/6hved/)
---

# To generate synthetic ECGs from Hugging face
```python
from transformers import AutoModel

model = AutoModel.from_pretrained("deepsynthbody/deepfake_ecg", trust_remote_code=True)

out = model(num_samples=5)
```



## [Pulse2Pulse - development repo](https://github.com/vlbthambawita/Pulse2Pulse)
If you want to train the model from scratch, please refere our development repository Pulse2Pulse.

---





## 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

```


### Pre-generated DeepFake ECGs and corresponding MUSE reports are here: https://osf.io/6hved/ or (https://huggingface.co/datasets/deepsynthbody/deepfake_ecg)
    - 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):


![Real vs Fake](real_vs_fake_left_to_right_v2.png)

## A sample DeepFake ECG:
![A regenerated sample](2879.png)


## 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:
```latex
@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](https://choosealicense.com/licenses/mit/)

## For more details: 
Please contact: vajira@simula.no, michael@simula.no