This project presents a deep learning model for the automated classification of heartbeat arrhythmias from electrocardiogram (ECG) signals. The model uses a hybrid architecture combining a 1D Convolutional Neural Network (CNN) with a Long Short-Term Memory (LSTM) network to accurately identify different types of heartbeats.
The project is developed in a Google Colab environment and culminates in a shareable web application built with Streamlit.
The goal of this project is to leverage deep learning to classify individual heartbeats into five main arrhythmia categories based on the AAMI standard (Normal, Supraventricular, Ventricular, Fusion, and Unknown). This addresses the need for automated, reliable tools to assist in diagnosing cardiac conditions.
The core of the project involves:
- Processing raw ECG signals from the well-known MIT-BIH Arrhythmia Database.
- Segmenting the continuous signals into individual heartbeats.
- Building and training a sophisticated hybrid model that learns both morphological and sequential patterns.
- Deploying the trained model as an interactive web application.
- Data Source: Uses the public MIT-BIH Arrhythmia Database from PhysioNet.
- Preprocessing: Implements a complete data preparation pipeline, including signal segmentation and class mapping.
- Hybrid Model: A 1D CNN extracts morphological features from each heartbeat, which are then fed into an LSTM to analyze temporal patterns.
- High Performance: Achieves high accuracy in classifying five distinct arrhythmia classes.
- Deployment: Includes a functional Streamlit web application (
app.py) for live classification.
- Python
- TensorFlow / Keras: For building and training the deep learning model.
- Streamlit: For creating and deploying the interactive web application.
- Scikit-learn: For data splitting and performance metrics.
- Pandas & NumPy: For data manipulation.
- WFDB: For reading the PhysioNet ECG data.
- Google Colab: As the primary development environment.
To get a local copy up and running, follow these simple steps.
You need to have Python 3.8+ installed.
- Clone the repo
git clone [https://github.com/your_username/your_repository_name.git](https://github.com/your_username/your_repository_name.git)
- Navigate to the project directory
cd your_repository_name - Install the required packages
pip install -r requirements.txt
To run the web application locally, use the following command in your terminal:
streamlit run app.py