HeartNN: A High Accuracy Neural Network for Cardiac Auscultation

Heart disease is the leading cause of death globally, causing many millions of deaths each year. I created a custom deep convolutional neural network that can classify heartbeat sounds as normal or abnormal with an accuracy of 98%. I also developed a smartphone app that allows users to screen their own heart sounds for abnormality. This technology serves as a preliminary screening to test if you have a heart problem and if you need to see a healthcare professional. I hope that this project can reduce the incidence of undiagnosed heart problems.

Abstract

Heart diseases are a major public health problem worldwide. According to the World Health Organization (WHO), cardiovascular diseases are the leading cause of death globally, taking around 17.9 million lives each year. Thus, early detection of heart problems is crucial for improving patient outcomes.  To detect heart problems, heart sounds or phonocardiograms (PCGs) can be manually heard and analyzed by trained experts using stethoscopes, in a process called cardiac auscultation. Abnormal heart sounds such as heart murmurs can be indicative of a variety of heart diseases, such as mitral regurgitation, aortic sclerosis and more. Therefore, analyzing heart sounds can provide valuable information for the diagnosis of heart diseases. In this project, I aim to develop a system to automatically classify heart sounds as normal or abnormal at very high accuracy. I model this as an image classification problem by converting audio samples into a visual representation using features such as Mel Frequency Cepstral Coefficients. This transformation allows me to use a convolutional neural network (CNN) based design, which is known to be highly accurate at image classification tasks. My model achieves a test accuracy of around 98% after being trained on the heart sounds from the publicly available PhysioNet/CinC Challenge 2016 dataset. We further develop a smartphone app that uses this model to classify new heart sound data. My research paves the way for low-cost and scalable early detection of heart disease, potentially preventing deaths due to undiagnosed heart conditions. 

Introduction and Background

Heart disease is a significant health concern and a leading cause of death globally. In the United States, heart disease remains the number one cause of death for men, women, and most racial and ethnic groups. Every year, hundreds of thousands of people die from heart disease, which includes various conditions that affect the heart, such as coronary artery disease, heart failure, and arrhythmias. In 2020, approximately 697,000 people in the United States died from heart disease, which accounted for 1 in every 5 deaths. This alarming statistic indicates that heart disease remains a significant public health concern in the United States. Moreover, heart disease imposes a significant economic burden on the country, with an estimated annual cost of around $229 billion, including healthcare services, medication, and lost productivity due to death. Cardiovascular diseases (CVDs) are a leading cause of death not just in America but also globally, causing approximately 17.3 million deaths per year, and the number is expected to rise to over 23.6 million by 2030. The lack of regular heart screening due to unhealthy lifestyles, financial constraints, and neglect can increase the risk of CVDs. Early diagnosis of CVDs is crucial in reducing the risk of heart failure. Diagnosis can be done using auscultation methods such as stethoscopes, phonocardiograms, or echocardiograms. Using a stethoscope, a cardiologist listens for unusual heart sounds (murmurs), which can indicate cardiac abnormalities. This method requires a person to visit a qualified and trained doctor to hear their heart sounds and decide on further action if needed. Normal and abnormal sounds differ significantly from each other with respect to time, amplitude, intensity, homogeneity, spectral content, and more, lending itself suitable for a machine learning model to classify.

Project Details

Dataset

I used the publicly available PhysioNet Heart Sounds Dataset to train my neural network. The dataset contains thousands of recordings of normal and abnormal heart sounds.

Data Preprocessing

I first split the audio files into segments of five seconds each. Then, I used the Python librosa library to convert those segments into Mel-Frequency Cepstral Coefficients (MFCCs), which are commonly used in audio signal processing and analysis. The MFCCs were then used as input to the neural network.

Neural Network

The HeartNN neural network is a deep convolutional neural network consisting of 22 layers. The model has several Conv2D layers, which extract features from the input image, followed by MaxPooling2D layers, which reduce the size of the image. Dropout layers are added to prevent overfitting. Finally, a GlobalAveragePooling2D layer flattens the output of the previous layer, and a Dense layer with a softmax activation function predicts the class of the image. The model was trained using a binary cross-entropy loss function and the Adam optimizer. 

Smartphone app

I developed a web API using Flask and Python to run HeartNN neural network inference on the cloud. I then programmed a smartphone app in Kotlin using Android Studio. The app enables users to diagnose their own heart sounds.

Awards and Honors

This project won the following awards:

  • First Place Technology Award at the national Thermo Fisher Junior Innovators Challenge
  • First Place at Washington State Science and Engineering Fair
  • Best in Category at Washington State Science and Engineering Fair
  • National STEM Challenge Finalist
  • National STEM Challenge Champion
  • Special Award in Health and Fitness at Washington State Science and Engineering Fair