Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Scripts and modules for training and testing neural network for ECG automatic classification. Companion code to the paper "Automatic diagnosis of the 12-lead ECG using a deep neural network".
| Date | Stars |
|---|---|
| 2026-07-31 | 449 |
| 2026-08-05 | 449 |
| 2026-08-06 | 449 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Automatic ECG diagnosis using a deep neural network
Scripts and modules for training and testing deep neural networks for ECG automatic classification.
Companion code to the paper "Automatic diagnosis of the 12-lead ECG using a deep neural network".
https://www.nature.com/articles/s41467-020-15432-4.
--------
Citation:
```
Ribeiro, A.H., Ribeiro, M.H., Paixão, G.M.M. et al. Automatic diagnosis of the 12-lead ECG using a deep neural network.
Nat Commun 11, 1760 (2020). https://doi.org/10.1038/s41467-020-15432-4
```
Bibtex:
```
@article{ribeiro_automatic_2020,
title = {Automatic Diagnosis of the 12-Lead {{ECG}} Using a Deep Neural Network},
author = {Ribeiro, Ant{\^o}nio H. and Ribeiro, Manoel Horta and Paix{\~a}o, Gabriela M. M. and Oliveira, Derick M. and Gomes, Paulo R. and Canazart, J{\'e}ssica A. and Ferreira, Milton P. S. and Andersson, Carl R. and Macfarlane, Peter W. and Meira Jr., Wagner and Sch{\"o}n, Thomas B. and Ribeiro, Antonio Luiz P.},
year = {2020},
volume = {11},
pages = {1760},
doi = {https://doi.org/10.1038/s41467-020-15432-4},
journal = {Nature Communications},
number = {1}
}
```
-----
## Requirements
This code was tested on Python 3 with Tensorflow `2.2`. There is an older branch ([`tensorflow-v1`](https://github.com/antonior92/automatic-ecg-diagnosis/tree/tensorflow-v1)) that
contain the code implementation for Tensorflow `1.15`.
**For pytorch users:** If you are interested in a pytorch implementation, take a look in the repository: https://github.com/antonior92/ecg-age-prediction.
There we provide a implementation in PyTorch of the same resnet-based model. The problem there is the age prediction from the ECG, nontheless simple modifications should suffice for dealing with abnormality classification.
## Model
The model used in the paper is a residual neural. The neural network architecture implementation in Keras is available in ``model.py``. To print a summary of the model layers run:
```bash
$ python model.py
```

The model receives an input tensor with dimension `(N, 4096, 12)`, and returns an output tensor with dimension `(N, 6)`,
for which `N` is the batch size.
The model can be trained using the script `train.py`. Alternatively,
pre-trained weighs for the models described in the paper are also
available in: https://doi.org/10.5281/zenodo.3625017. Or in the mirror dropbox
link [here](https://www.dropbox.com/s/5ar6j8u9v9a0rmh/model.zip?dl=0).
Using the command line, the weights can be downloaded using
```
wget https://www.dropbox.com/s/5ar6j8u9v9a0rmh/model.zip?dl=0 -O model.zip
unzip model.zip
```
- **input**: `shape = (N, 4096, 12)`. The input tensor should contain the `4096` points of the ECG tracings
sampled at `400Hz` (i.e., a signal of approximately 10 seconds). Both in the training and in the test set, when the
signal was not long enough, we filled the signal with zeros, so 4096 points were attained. The last dimension of the
tensor contains points of the 12 different leads. The leads are ordered in the following order:
`{DI, DII, DIII, AVR, AVL, AVF, V1, V2, V3, V4, V5, V6}`. All signal are represented as
32 bits floating point numbers at the scale 1e-4V: so if the signal is in V it should be multiplied by
1000 before feeding it to the neural network model.
- **output**: `shape = (N, 6)`. Each entry contains a probability between 0 and 1, and can be understood as the
probability of a given abnormality to be present. The abnormalities it predicts are **(in that order)**: 1st degree AV block(1dAVb),
right bundle branch block (RBBB), left bundle branch block (LBBB), sinus bradycardia (SB), atrial fibrillation (AF),
sinus tachycardia (ST). The abnormalities are not mutually exclusive, so the probabilities do not necessarily
sum to one.
![abnormalities](https://media.springernature.com/full/springExcerpt of 6,157 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:146f3eda06a8d836, topic:deep-learning