I built a framework for training neural networks to detect heart attacks from ECGs.
Here’s a link: https://github.com/goodwordalchemy/ekg-network
This tool allows you to build models easily and configure a hyper parameter search strategy. I have mostly created this tool for my own explorations, but I have designed it to make it easy for a curious AI beginner like me to use.
Discussion on the Process of Building This Tool
Building this framework allowed me to merge many of my skills and interests. First and foremost, this project allows me to practice building neural networks using tensorflow and keras. However, in order to train keras models on this dataset, I had to first get the ECG data. I got the data from a public database of digitized ECG signals. Unfortunately, these digitized ECGs are very different than those that you might have taken in an ambulance or a hospital. In addition to the fact that those are usually printed on a piece of paper, there’s the fact that this dataset has 1000 samples per second, whereas the typical EKG machine samples at 40 Hz. But this is the only publicly available data I could find, so I went with it.
As soon as I started training on that data, I ran into time and memory issues on my Mac. The models took to long to train and required too much memory. So I learned how to configure a Google Cloud Compute instance with a GPU. This last task required re-learning how to use Docker. The Keras faq says that Keras automatically works if you have a GPU attached to your instance. I took this to mean that all I had to do was start a Google Cloud Compute instance with a GPU attached as specified in the Google Cloud Compute docs, but it turns out there is some GPU software that you need to have installed on your instance in order to have Keras automatically use your GPU. I tried following this blog post, but it was taking forever to copy the nvidia sofware around in the Starbucks where I was working, and I couldn’t imagine doing that every time that I want to start one of these instances (I turn my instance off when I am not using it). It turned out that using these instructions from Nvidia on how to create a GCP instance with a GPU and all the right software for deep learning are pretty easy to follow. Then I found that tensorflow provides a docker image that allows you to use a gpu provided you have the nvidia software installed, and it was a cinch to get up and running.
The most recent model that I’ve worked on is stored in `models/simple_inception.py`. It is based on the work in this paper, where the authors used a single-layer inception module. I am currently experimenting with different numbers of filters and inception modules.