Skip to content

Repository files navigation

ECG Arrhythmia Classification using a Hybrid CNN-LSTM Model

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.

About The Project

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.

Key Features

  • 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.

Technologies Used

  • 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.

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

You need to have Python 3.8+ installed.

Installation

  1. Clone the repo
    git clone [https://github.com/your_username/your_repository_name.git](https://github.com/your_username/your_repository_name.git)
  2. Navigate to the project directory
    cd your_repository_name
  3. Install the required packages
    pip install -r requirements.txt

Usage

To run the web application locally, use the following command in your terminal:

streamlit run app.py

About

A hybrid CNN-LSTM deep learning model for classifying ECG heartbeat arrhythmias from the MIT-BIH dataset, deployed as a Streamlit web application

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages