A deep learning framework for non-invasive, automated respiratory disease detection through cough audio analysis.
This project presents an automated two-stage pipeline for diagnosing respiratory diseases from cough sounds — without any invasive procedures or specialized medical equipment.
Stage 1 — Cough Detection: Distinguishes cough sounds from background noise using MFCC features + CNN classifier.
Stage 2 — Disease Classification: Classifies detected coughs into specific respiratory conditions using a multi-class CNN model.
Stage 3 — Wavelet Enhancement: Uses Continuous Wavelet Transform (CWT) scalograms to improve time-frequency representation and disease discrimination.
- Asthma
- Bronchitis
- Chronic Obstructive Pulmonary Disease (COPD)
- Pneumonia
- Bronchiolitis
- Bronchiectasis
- Upper Respiratory Tract Infection (URTI)
- Healthy (control)
Raw Audio Input
│
▼
┌─────────────────────────────┐
│ Preprocessing │
│ • Noise reduction │
│ • Amplitude normalization │
│ • 6-second segmentation │
└─────────────┬───────────────┘
│
┌────────┴────────┐
▼ ▼
┌─────────┐ ┌──────────────┐
│ MFCC │ │ Wavelet CWT │
│ Features│ │ Scalograms │
└────┬────┘ └──────┬───────┘
│ │
▼ ▼
┌─────────┐ ┌──────────────┐
│ CNN │ │ CNN │
│ Phase 1 │ │ Phase 2 │
│ (Cough │ │ (Disease │
│ Detect) │ │ Classify) │
└────┬────┘ └──────┬───────┘
│ │
└────────┬────────┘
▼
Disease Prediction
+ Class Probabilities
| Metric | Value |
|---|---|
| Detection Accuracy | 97.4% |
| Confidence Score (sample) | 0.9931 |
| F1-Score | 0.9709 |
| Accuracy Score | 0.9815 |
| Sampling Rate | Precision | Recall | F1-Score | Accuracy |
|---|---|---|---|---|
| 12 kHz | 0.49 | 0.48 | 0.46 | 0.93 |
| 16 kHz | 0.40 | 0.53 | 0.44 | 0.87 |
| 22.05 kHz | 0.48 | 0.52 | 0.48 | 0.86 |
| 40 kHz | 0.60 | 0.45 | 0.49 | 0.93 |
Overall validation accuracy: 92%
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| Bronchiectasis | 0.92 | 0.92 | 0.92 |
| Bronchiolitis | 0.94 | 0.92 | 0.93 |
| COPD | 0.96 | 0.90 | 0.91 |
| Healthy | 0.94 | 0.94 | 0.95 |
| Pneumonia | 0.92 | 0.94 | 0.94 |
| URTI | 0.92 | 0.92 | 0.92 |
| Overall Accuracy | 0.90 |
- Pre-emphasis — First-order FIR filter (α = 0.95–0.97)
- Framing — 20–30 ms overlapping frames
- Windowing — Hamming window
- STFT — Short-Time Fourier Transform for spectral analysis
- Mel Filter Bank — Perceptual frequency scaling
- DCT — Discrete Cosine Transform for cepstral coefficients (12–20 coefficients)
- CWT — Continuous Wavelet Transform using Morlet wavelet
- Scalogram — 2D time-frequency energy map
- Log Compression — Enhances dynamic range
- CNN Input — Scalogram images fed to CNN for classification
Input (MFCC: 40 coefficients × Time Frames)
→ Conv2D (32 filters, 3×3) + ReLU + BatchNorm + MaxPooling
→ Conv2D (64 filters, 3×3) + ReLU + BatchNorm + MaxPooling
→ Conv2D (128 filters, 3×3) + ReLU + BatchNorm
→ Global Average Pooling
→ Dense (128) + ReLU + Dropout (0.4)
→ Output (Softmax, n_classes)
ICBHI 2017 Respiratory Sound Database
- 126 participants (children, adults, elderly)
- 920 labeled recordings (10–90 seconds each)
- ~5.5 hours of audio
- 6,898 respiratory cycles
- 886 with wheezes
- 1,864 with crackles
- 506 with both
- Language: Python
- Audio Processing: Librosa, NumPy, SciPy
- Feature Extraction: MFCC, CWT (Morlet Wavelet)
- Deep Learning: TensorFlow / Keras (CNN)
- Visualization: Matplotlib
- Data Augmentation: Noise addition, time stretching, pitch shifting
- Cough detection CNN achieves 97.4% accuracy with MFCC features
- 12 kHz sampling rate offers the most balanced performance for disease classification — most clinically relevant cough features lie below 6–8 kHz
- Wavelet (CWT) scalograms outperform MFCCs for non-stationary transient events (crackles, wheezes), improving accuracy from ~83% to 90%
- COPD and Pneumonia achieve the highest per-class accuracy due to distinct spectral signatures
- Minority classes (URTI, LRTI) suffer from limited data — augmentation and GAN-based synthesis recommended for future work
- Expand dataset with more diverse cough samples
- GAN-based data synthesis for rare disease classes
- Transfer learning and attention mechanisms for subtle acoustic variations
- Real-time mobile/web-based screening tool
- Explainable AI (XAI) for clinical trust
- Multi-modal integration (audio + patient metadata)
- Al-Anazi et al., "Artificial intelligence in respiratory care," Annals of Thoracic Medicine, 2024.
- Albawi et al., "Understanding of Convolutional Neural Network (CNN)," ICET, 2017.
- Ghrabli, Elgendi & Menon, "A spectrogram-based framework for identifying spectral fingerprints in cough sounds," 2024.
- Author et al., "AI-assisted COVID-19 cough screening using MFCC and log-Mel features," 2023.
- Sriram, Kumar & Singh, "AI-based cough sound analysis: A survey of ML and DL methods," 2022.
- Author et al., "Systematic review of AI-based biomedical sound analysis," 2024.
- Bhattacharya et al., "Wavelet-enhanced CNN for chronic cough detection," 2022.
- Aykanat et al., "Automatic classification of adventitious respiratory sounds using CNNs," 2017.
"By combining signal processing and deep learning, this framework provides a scalable and efficient solution for automated respiratory disease diagnosis — supporting remote health monitoring and early screening."