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.3.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.3-py3-none-any.whl (92.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heart_murmur_analysis-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 bf8e9d40b325ce35c4f3805e4b25b3378931b21c67c909cdd452b3be2b7eb9d2
MD5 2db823eb0c2c2627faacf19fbb739280
BLAKE2b-256 049cd69757cdd0e9aa84f567876513cbcdc2be4eecfd721b523e21e9238fb2d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48b4d9f6c871b8719ac9bbbbcecc37d7c9fdb85936bb00eb6cc85a95a3c24449
MD5 8d8966bb1efc971e50f67573b8c88bd2
BLAKE2b-256 9c23158acbcda1d0a9e96bec5d35a2a4777a6d225b7ff25a8f2717e0b3acfd41

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