a b/README.md
1
## Install 
2
3
Clone the repository
4
5
```
6
git clone git@github.com:awni/ecg.git
7
```
8
9
If you don't have `virtualenv`, install it with
10
11
```
12
pip install virtualenv
13
```
14
15
Make and activate a new Python 2.7 environment
16
17
```
18
virtualenv -p python2.7 ecg_env
19
source ecg_env/bin/activate
20
```
21
22
Install the requirements (this may take a few minutes).
23
24
For CPU only support run
25
```
26
./setup.sh
27
```
28
29
To install with GPU support run
30
```
31
env TF=gpu ./setup.sh
32
```
33
34
## Training
35
36
In the repo root direcotry (`ecg`) make a new directory called `saved`.
37
38
```
39
mkdir saved
40
```
41
42
To train a model use the following command, replacing `path_to_config.json`
43
with an actual config:
44
45
```
46
python ecg/train.py path_to_config.json
47
```
48
49
Note that after each epoch the model is saved in
50
`ecg/saved/<experiment_id>/<timestamp>/<model_id>.hdf5`.
51
52
For an actual example of how to run this code on a real dataset, you can follow
53
the instructions in the cinc17 [README](examples/cinc17/README.md). This will
54
walk through downloading the Physionet 2017 challenge dataset and training and
55
evaluating a model.
56
57
## Testing
58
59
After training the model for a few epochs, you can make predictions with.
60
61
```
62
python ecg/predict.py <dataset>.json <model>.hdf5
63
```
64
65
replacing `<dataset>` with an actual path to the dataset and `<model>` with the
66
path to the model.
67
68
## Citation and Reference
69
70
This work is published in the following paper in *Nature Medicine*
71
72
[Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network](https://www.nature.com/articles/s41591-018-0268-3)
73
74
If you find this codebase useful for your research please cite:
75
76
```
77
@article{hannun2019cardiologist,
78
  title={Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network},
79
  author={Hannun, Awni Y and Rajpurkar, Pranav and Haghpanahi, Masoumeh and Tison, Geoffrey H and Bourn, Codie and Turakhia, Mintu P and Ng, Andrew Y},
80
  journal={Nature Medicine},
81
  volume={25},
82
  number={1},
83
  pages={65},
84
  year={2019},
85
  publisher={Nature Publishing Group}
86
}
87
```
88
89