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.6.tar.gz (87.9 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.6-py3-none-any.whl (92.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heart_murmur_analysis-0.1.6.tar.gz
  • Upload date:
  • Size: 87.9 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.6.tar.gz
Algorithm Hash digest
SHA256 71e29908699c03337c4f1a34f066c56a304f1fc5f6b7f38c07a7535c586a9162
MD5 4741959ba0d6ec1928212bab218c84ff
BLAKE2b-256 752f8708ca9a07ba44b49403fcbd8bda29cd035cdaff5bbe80785b505c1ad80a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 58b8036c4cb29758afc5f3f71f997a5142e2b3349682773156db2cdf332f5dda
MD5 a6f887b6d2c752c70feb3e475f31eee4
BLAKE2b-256 93dbc3936c583c1134ef95bf7ea2e74b43ba6ebce0c5b470f568f56c582f570e

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