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.
Quick Start
Prerequisites
- Python 3.9 or higher
- Windows 10/11 (PowerShell)
- Git (optional, for cloning)
Installation Steps
-
Create Virtual Environment
python -m venv hvenv
-
Activate Virtual Environment
hvenv\Scripts\activate
You should see
(hvenv)at the beginning of your command prompt. -
Install the package
pip install heart-murmur-analysis
-
Run the Application
streamlit run test_file.py
Download the test_file.py
-
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
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Happy Heart Murmur Detection!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heart_murmur_analysis-0.2.2.tar.gz.
File metadata
- Download URL: heart_murmur_analysis-0.2.2.tar.gz
- Upload date:
- Size: 88.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fa225bd4819c8f507aa9d57dc6b0328b99da2a38be9ca1d70e0c74d1c303e46
|
|
| MD5 |
02fee31659cf5162a2e897535e88f7a5
|
|
| BLAKE2b-256 |
f9d2ed1881296391da14b8d32db7a319a95b834c821bda1763a12e12590f5531
|
File details
Details for the file heart_murmur_analysis-0.2.2-py3-none-any.whl.
File metadata
- Download URL: heart_murmur_analysis-0.2.2-py3-none-any.whl
- Upload date:
- Size: 93.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59bb75aa5ea0fa6875a06c03a9affffd1fce7f0ebea195242e3a3661c52731d0
|
|
| MD5 |
1d23791b7c705bf90424d1231a899f49
|
|
| BLAKE2b-256 |
b372d49666c81c3da2d65fb9812bba17565ccd26466ff1815f9e1b0dbee86ad5
|