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

Uploaded Python 3

File details

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

File metadata

  • Download URL: heart_murmur_analysis-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 63a780b8588e507e9be6194fa7f48e455de858c0db8b7c8afcadd2f8d02a8220
MD5 01ff53e3c88dba8a83fc647fefe70c5a
BLAKE2b-256 26000c04ec9ae7a9bf45ad2d5570d018d79a40dc6bebcbde0acc50041f6beb16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a11d79b3ff48dd209a5fe8754a2f752ab49b5b78405c3fc6334561e353f3791b
MD5 9fd1f037ebdeb74f48554cd9e6b76650
BLAKE2b-256 bbf637a3205b5526a9482b0be2335eab47eee18054f9d92f42170cb8705c1ba6

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