Deep learning approach
Residual Networks (ResNet)  are an architecture of CNNs that have produced excelent results in computer vision. Recently, Rajpurkar et al.  applied a 34-layer ResNet (very similar to the one proposed by ) to classify 30-s single lead ECGs segments into 14 different classes. This network is reproduced in this work, implemented using Keras framework with Tensorflow as backend.
The following packages were used to match the Challenge Sandbox environment:
- Python v3.5
- Tensorflow v1.0.0
- Keras v2.0.2
To facilitate the reproduction of our network, a Docker (what is Docker?) image of the system architecture for running this code is made available under https://hub.docker.com/r/andreotti/challenge2017/ . The image was generated for CPU and GPUs machine, just modify
To pull the Docker image use:
docker pull andreotti/challenge2017:<system_architecture>
To run this image using Jupyter notebook, you should copy the contents of the
deeplearn-approach folder into a
<LOCAL_FOLDER> and use the following code:
docker run -it -p 8888:8888 -p 6006:6006 -v <LOCAL_FOLDER>:/sharedfolder andreotti/challenge2017:cpu
nvidia-docker run -it -p 8888:8888 -p 6006:6006 -v <LOCAL_FOLDER>:/sharedfolder andreotti/challenge2017:gpu
Then the following line will start the Jupyter notebook on the Docker and give you a URL to follow on your machine's browser:
jupyter notebook --ip=0.0.0.0 --no-browser
ResNet_30s_34lay_16conv.hdf5Pre-trained model in HDF5 format. This model is a version of our best performing entry at CinC Challenge 2017. Contains 34 layers (as described by ) but 16*k convolutional filters for layer, increasing k every 4th loop. Expects as input 30s ECG long segments.
predict.pyloads one recording from CinC Challenge and use pre-trained model in predicting what it is
train_model.pyfunction used for training and cross-validating model using. The database is not included in this repo, please download the CinC Challenge database and truncate/pad data into a NxM matrix array, being N the number of recordings and M the window accepted by the network (i.e. 30 seconds). This procedure is exemplified in function cincset_files2matrix.py
cincset_files2matrix.pyThis simple function creates a NxM matrix from multiple .mat files downloaded from the CinC Challenge 2017. Target are coded in a Nx4 matrix (since there are 4 classes) as required by neural networks.
: He, K., Zhang, X., Ren, S., & Sun, J. (2015). Deep Residual Learning for Image Recognition. arXiv Preprint arXiv:1512.03385v1, 7(3), 171–180. https://doi.org/10.3389/fpsyg.2013.00124
: Rajpurkar, P., Hannun, A. Y., Haghpanahi, M., Bourn, C., & Ng, A. Y. (2017). Cardiologist-Level Arrhythmia Detection with Convolutional Neural Networks. Retrieved from http://arxiv.org/abs/1707.01836