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 ---

Quick Start

Prerequisites

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

Installation Steps

  1. Create Virtual Environment

    python -m venv hvenv
    
  2. Activate Virtual Environment

    hvenv\Scripts\activate
    

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

  3. Install the package

    pip install heart-murmur-analysis
    
  4. Run the Application

    streamlit run test_file.py
    

    Download the test_file.py

  5. 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 !

🧠 Concepts & Terminologies

Heart Sounds

  • S1 ("Lub"): Closing of the mitral and tricuspid valves.
  • S2 ("Dub"): Closing of the aortic and pulmonary valves.
  • Murmur: Abnormal sound caused by turbulent blood flow.
  • Artifact: Noise unrelated to actual heart sounds (e.g., movement, microphone noise).

🛠️ Signal Processing Pipeline

1. Preprocessing

  • Bandpass Filter (20–500 Hz): Retains important heart sound frequencies while removing noise.
  • Envelope Detection: Smooths the waveform to highlight heartbeats for peak detection.

2. Extracted Metrics

The application extracts several clinical metrics to assist in diagnosis:

Metric Description
BPM Average heart rate in beats per minute.
IBV/IBI Inter-Beat Interval – time between successive heartbeats.
HRV Heart Rate Variability (SDNN, RMSSD, pNN50).
SNR Signal-to-Noise Ratio (recording quality).
S1/S2 Ratio Helps distinguish murmurs from normal beats.
Spectral Energy Energy distribution below 200 Hz.

📊 Visualizations

  • Waveform with Peaks: Visualizes detected beats.
  • Spectrogram: Frequency vs. time representation.
  • Poincaré Plot: Nonlinear HRV visualization.

🤖 Model Architecture

The LSTM model uses a hybrid CNN-LSTM architecture:

  • Input: Raw audio data (52 timesteps).
  • CNN Layers: 3 Conv1D layers for feature extraction.
  • LSTM Layers: 2 LSTM layers for temporal modeling.
  • Output: 3 classes (Normal, Murmur, Artifact).

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.9.tar.gz (88.5 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.9-py3-none-any.whl (93.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heart_murmur_analysis-0.1.9.tar.gz
  • Upload date:
  • Size: 88.5 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.9.tar.gz
Algorithm Hash digest
SHA256 9515b5096d1e3fd22d0bbd4135eea52ae463f7f64daeb6d3d6d35550c3ba933a
MD5 7466de013a288802a9231a686bae4b6f
BLAKE2b-256 be8d3b03cace0dc46298364eb93efa0071f71d71ae12efd2ed0da965861dfc60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heart_murmur_analysis-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6ccb522172e75d6e781c97948cf510ad5a144360f8acbe0a48090f4c2ba3bac4
MD5 861e12ba900c52c3b5ed3f689ba5be18
BLAKE2b-256 80aa425cb604da430e6b93ae2fe2eff2669c09fa0276dee94ecb888f8b4c8f61

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