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

Uploaded Python 3

File details

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

File metadata

  • Download URL: heart_murmur_analysis-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 02bf0dc97c56eab2ddae2a31cf909d90217877ed901aaf0bad162c256de3b923
MD5 1eecf458edfa0fd7e0181a85cdf3725d
BLAKE2b-256 4c722d52055d3facc5559276436666a5148bc14886f566aff5140499e9491703

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 132ef0b4c999f48d2c131cfab44f4385bbd9d414d5a7cbaab07d46ee3106bd60
MD5 198c8f355663109a3255f2abfb88eb11
BLAKE2b-256 5ffc73ffe4fd471e0001361be7394a5420d065307356b7061ae54e2edb3059b2

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