|
a |
|
b/ecg/README.md |
|
|
1 |
##### This work and code is developed by the awesome team of Awni et al, StanfordML Group. I have just modified it to work with python3 and few other changes for my comfort of use. |
|
|
2 |
|
|
|
3 |
## Install |
|
|
4 |
|
|
|
5 |
Clone the repository |
|
|
6 |
|
|
|
7 |
``` |
|
|
8 |
git clone git@github.com:manideep2510/ECG-acquisition-classification.git |
|
|
9 |
``` |
|
|
10 |
|
|
|
11 |
**Python 3.5 or higher is required to run the code. To test the code the with the pretrained models, Python 3.5 is the only one it supports** |
|
|
12 |
|
|
|
13 |
Install the requirements (this may take a few minutes). |
|
|
14 |
|
|
|
15 |
For CPU only support run |
|
|
16 |
``` |
|
|
17 |
cd ecg |
|
|
18 |
./setup.sh |
|
|
19 |
``` |
|
|
20 |
|
|
|
21 |
To install with GPU support run |
|
|
22 |
``` |
|
|
23 |
env TF=gpu ./setup.sh |
|
|
24 |
``` |
|
|
25 |
|
|
|
26 |
## Training |
|
|
27 |
|
|
|
28 |
In the repo root direcotry (`ecg`) make a new directory called `saved`. |
|
|
29 |
|
|
|
30 |
``` |
|
|
31 |
mkdir saved |
|
|
32 |
``` |
|
|
33 |
|
|
|
34 |
To train a model use the following command, replacing `path_to_config.json` |
|
|
35 |
with an actual config: |
|
|
36 |
|
|
|
37 |
``` |
|
|
38 |
python ecg/train.py path_to_config.json |
|
|
39 |
``` |
|
|
40 |
|
|
|
41 |
Note that after each epoch the model is saved in |
|
|
42 |
`ecg/saved/<experiment_id>/<timestamp>/<model_id>.hdf5`. |
|
|
43 |
|
|
|
44 |
For an actual example of how to run this code on a real dataset, you can follow |
|
|
45 |
the instructions in the cinc17 [README](examples/cinc17/README.md). This will |
|
|
46 |
walk through downloading the Physionet 2017 challenge dataset and training and |
|
|
47 |
evaluating a model. |
|
|
48 |
|
|
|
49 |
## Testing |
|
|
50 |
|
|
|
51 |
After training the model for a few epochs, you can make predictions with. |
|
|
52 |
|
|
|
53 |
``` |
|
|
54 |
python ecg/predict.py <dataset>.json <model>.hdf5 |
|
|
55 |
``` |
|
|
56 |
|
|
|
57 |
replacing `<dataset>` with an actual path to the dataset and `<model>` with the |
|
|
58 |
path to the model. |
|
|
59 |
|
|
|
60 |
## Citation and Reference |
|
|
61 |
|
|
|
62 |
This work is published in the following paper in *Nature Medicine* |
|
|
63 |
|
|
|
64 |
[Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network](https://www.nature.com/articles/s41591-018-0268-3) |
|
|
65 |
|
|
|
66 |
If you find this codebase useful for your research please cite: |
|
|
67 |
|
|
|
68 |
``` |
|
|
69 |
@article{hannun2019cardiologist, |
|
|
70 |
title={Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network}, |
|
|
71 |
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}, |
|
|
72 |
journal={Nature Medicine}, |
|
|
73 |
volume={25}, |
|
|
74 |
number={1}, |
|
|
75 |
pages={65}, |
|
|
76 |
year={2019}, |
|
|
77 |
publisher={Nature Publishing Group} |
|
|
78 |
} |
|
|
79 |
``` |
|
|
80 |
|
|
|
81 |
|