Skip to main content

Heartbeat analysis using Deep Learning, Signal Processing, and AI Agents.

Project description

๐ŸŽต Heart Murmur Detection with LSTM

A deep learning application that uses LSTM neural networks to detect heart murmurs from audio recordings. The application provides a user-friendly Streamlit interface for uploading audio files and getting real-time predictions with signal processing.


Heart_Murmur_Pipelinee drawio ---

๐Ÿ“ Project Structure

heart_app/
โ”‚
โ”œโ”€โ”€ main.py                         # Streamlit entry point
โ”‚
โ”œโ”€โ”€ classification/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ model_loader.py             # Loads the trained LSTM model
โ”‚   โ”œโ”€โ”€ classifier.py               # Runs prediction + preprocessing
โ”‚
โ”œโ”€โ”€ signal_processing/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ loader.py                   # Load & normalize wav
โ”‚   โ”œโ”€โ”€ preprocessing.py            # Bandpass filter, envelope extraction
โ”‚   โ”œโ”€โ”€ features.py                 # Peak detection, HRV, SNR, Energy, etc.
โ”‚   โ”œโ”€โ”€ visualizer.py               # Plot waveform, spectrogram, histograms
โ”‚   โ”œโ”€โ”€ analyzer.py                 # Combines all steps, generates report
โ”‚
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ printer.py                  # Pretty print reports
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ lstm_model.h5               # Pre-trained LSTM model
โ”‚
โ”œโ”€โ”€ reports/
โ”‚   โ”œโ”€โ”€ heartbeat_report.json       # Generated reports (saved outputs)
โ”‚
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

Quick Start

Prerequisites

  • Python 3.8 or higher
  • Windows 10/11 (PowerShell)
  • Git (optional, for cloning)

Installation Steps

  1. Clone or Download the Project

    git clone <repository-url>
    cd Heart-Murmur-Disease
    

    Or download and extract the project folder.

  2. Create Virtual Environment

    python -m venv hvenv
    
  3. Activate Virtual Environment

    hvenv\Scripts\Activate.ps1
    

    You should see (hvenv) at the beginning of your command prompt.

  4. Install Dependencies

    pip install -r requirements.txt
    
  5. Run the Application

    streamlit run app.py
    
  6. Access the Application

    • Open your web browser
    • Navigate to http://localhost:8501
    • Upload a WAV or MP3 audio file
    • Get instant heart murmur predictions with signal processing !

Install Dependencies

The requirements.txt file contains all necessary packages:

Install them with:

pip install -r requirements.txt

Step 4: Run the Application

streamlit run app.py

About Model Architecture

The LSTM model uses a hybrid CNN-LSTM architecture:

  • Input: Raw audio data (52 timesteps, 1 feature)
  • CNN Layers: 3 Conv1D layers with MaxPooling and BatchNormalization
  • LSTM Layers: 2 LSTM layers for sequence modeling
  • Dense Layers: 3 fully connected layers with dropout
  • Output: 3 classes (Normal, Abnormal, Murmur)
  • Total Parameters: 14,130,371 (53.90 MB)

Performance Tips

  • Sample Rate: The model expects 22050 Hz (automatically handled)

Technical Details

Input Preprocessing

  • Audio is loaded at 22050 Hz sample rate
  • Truncated or padded to exactly 52 samples
  • Reshaped to (1, 52, 1) for model input

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Happy Heart Murmur Detection!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heart_murmur_analysis-0.1.4.tar.gz (87.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heart_murmur_analysis-0.1.4-py3-none-any.whl (92.4 kB view details)

Uploaded Python 3

File details

Details for the file heart_murmur_analysis-0.1.4.tar.gz.

File metadata

  • Download URL: heart_murmur_analysis-0.1.4.tar.gz
  • Upload date:
  • Size: 87.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for heart_murmur_analysis-0.1.4.tar.gz
Algorithm Hash digest
SHA256 62d234173745e948815f08b1f29514ff43794ab7c83ac67b98a719b78683a2a0
MD5 fcc04b00c5552562b5131598606fd0ff
BLAKE2b-256 d794907238cdcaabe3769907e4e14c34a08cc06dfc6aa8fe123c8a050e881a01

See more details on using hashes here.

File details

Details for the file heart_murmur_analysis-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0387817a6534ed62948e1bf223e3c3b3e5d982b3c1ee03fdb842bd6161a42ee3
MD5 f761b89ddfee2ca7a0691c239094c22f
BLAKE2b-256 b31c967480a2a3ca5f7c2f92d9b62002e2b7683ff539834b91a9b4c069f988ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page