Spaces:
Configuration error
Configuration error
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -11,17 +11,13 @@ pinned: false
|
|
| 11 |
|
| 12 |
# Anvaya: Multi-Modal Speech Disfluency & Articulation Screening Prototype
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
Anvaya is an open-source exploratory research framework designed for assistive speech disfluency screening, acoustic phonation analysis, and phonological practice feedback. The system combines fine-tuned self-supervised acoustic representations (Wav2Vec 2.0 with Low-Rank Adaptation), Connectionist Temporal Classification (CTC) Goodness of Pronunciation (GOP), and acoustic correlates of phonation extracted via Parselmouth/Praat.
|
| 17 |
-
|
| 18 |
-
**Scientific & Clinical Scope Disclaimer**: Anvaya is an educational and screening research prototype. It is **not** an FDA-cleared medical device, nor does it perform direct physical/biomechanical vocal fold imaging. All diagnostic classifications represent acoustic approximations and rule-based heuristic scoring intended for research exploration and self-guided speech practice.
|
| 19 |
|
| 20 |
---
|
| 21 |
|
| 22 |
-
## 1.
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
```
|
| 27 |
===================================================================================
|
|
@@ -34,7 +30,7 @@ The prototype executes four distinct acoustic feature extractors followed by a r
|
|
| 34 |
| ACOUSTIC SIGNAL PRECONDITIONING |
|
| 35 |
| - Sample Rate: 16,000 Hz Mono Float32 |
|
| 36 |
| - High-Pass Filter: 60 Hz 2nd-Order Butterworth (DC rumble attenuation) |
|
| 37 |
-
| - Dynamic Energy Gate: Silence Guard (RMS thresholding)
|
| 38 |
| - Peak Normalization: Standardized to -1.0 dBFS |
|
| 39 |
+---------------------------------------------------------------------------------+
|
| 40 |
|
|
|
@@ -46,7 +42,7 @@ The prototype executes four distinct acoustic feature extractors followed by a r
|
|
| 46 |
| Neural Disfluency Classifier | | Phonetic GOP & ASR Alignment |
|
| 47 |
| - Wav2Vec 2.0 Base (768-dim) | | - Wav2Vec 2.0 Base 960h CTC |
|
| 48 |
| - LoRA Adapter (r=8, alpha=16) | | - Needleman-Wunsch DP Alignment |
|
| 49 |
-
| - Focal Loss
|
| 50 |
| Outputs: P(Fluent), P(Stutter) | | Outputs: Word Diffs, GOP Score |
|
| 51 |
+-----------------------------------+ +-----------------------------------+
|
| 52 |
| |
|
|
@@ -57,221 +53,121 @@ The prototype executes four distinct acoustic feature extractors followed by a r
|
|
| 57 |
v v
|
| 58 |
+-----------------------------------+ +-----------------------------------+
|
| 59 |
| EXPERT MODULE 3: | | EXPERT MODULE 4: |
|
| 60 |
-
| Phonetic Flaw
|
| 61 |
| - Rhotic Error Mapping ('r'->'w')| | - Parselmouth / Praat Core |
|
| 62 |
| - Sibilant Lisping ('s'->'th') | | - Pitch Period Tracking (F0) |
|
| 63 |
-
| -
|
| 64 |
-
| Outputs: Heuristic Flaw
|
| 65 |
+-----------------------------------+ +-----------------------------------+
|
| 66 |
|
|
| 67 |
v
|
| 68 |
+---------------------------------------------------------------------------------+
|
| 69 |
-
|
|
| 70 |
| - Heuristic Fluency Index (0 to 100): 40% Stutter, 45% Pronunciation, 15% Voice|
|
|
|
|
| 71 |
| - Uncertainty & Confidence Scoring: Low / Moderate / High |
|
| 72 |
-
| - Baseline Calibration: Offset Transformation relative to "My Normal" |
|
| 73 |
| - Evidence Audit Trail: JSON Telemetry Trace |
|
| 74 |
+---------------------------------------------------------------------------------+
|
| 75 |
```
|
| 76 |
|
| 77 |
---
|
| 78 |
|
| 79 |
-
## 2.
|
| 80 |
-
|
| 81 |
-
All metrics reported below were evaluated on a held-out test partition of 1,666 clips from out-of-training speakers to evaluate generalization.
|
| 82 |
-
|
| 83 |
-
### 2.1 Complete Evaluation Matrix
|
| 84 |
-
|
| 85 |
-
| Metric Category | Metric Name | Measured Value | Scientific Interpretation & Formula |
|
| 86 |
-
| :--- | :--- | :--- | :--- |
|
| 87 |
-
| **Neural Disfluency** | **Macro-F1 Score** | **71.47%** | Balanced harmonic mean across fluent and disfluent classes |
|
| 88 |
-
| | **Overall Test Accuracy** | **71.49%** | Total correct classifications on held-out test split |
|
| 89 |
-
| | **ROC-AUC** | **0.7669** | Area under the Receiver Operating Characteristic curve |
|
| 90 |
-
| **Clinical Screening**| **Sensitivity (Recall)**| **75.71%** | True Positive Rate: Percentage of actual stutter events identified |
|
| 91 |
-
| | **Specificity (TNR)** | **67.28%** | True Negative Rate: Percentage of fluent segments correctly cleared |
|
| 92 |
-
| | **Precision (PPV)** | **85.05% - 97.58%**| Positive Predictive Value on synthesized & clinical test subsets |
|
| 93 |
-
| | **False Negative Rate** | **24.29%** | $\text{FNR} = 1 - \text{Sensitivity}$: Missed disfluency events |
|
| 94 |
-
| | **False Positive Rate** | **32.72%** | $\text{FPR} = 1 - \text{Specificity}$: Fluent speech flagged as disfluent |
|
| 95 |
-
| **Pronunciation (ASR)**| **Word-Level Accuracy** | **95.80%** | $(1.0 - \text{WER}) \times 100\%$ on standard clean read speech |
|
| 96 |
-
| | **Word Error Rate (WER)** | **4.20%** | Levenshtein word distance over reference text |
|
| 97 |
-
| | **Character Error Rate**| **1.85%** | Sub-word character distance |
|
| 98 |
-
| **Acoustic Correlates**| **Pitch ($F_0$) Corr.** | **$r = 0.992$** | Pearson correlation against Praat ground-truth pitch contours |
|
| 99 |
-
| | **Local Jitter Error** | **$\pm 0.0018$** | Cycle-to-cycle pitch perturbation variance |
|
| 100 |
|
| 101 |
-
--
|
| 102 |
|
| 103 |
-
##
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
**
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
-
The system uses Parselmouth (Praat) to extract **acoustic correlates** of voice quality:
|
| 114 |
-
- Fundamental Frequency ($F_0$)
|
| 115 |
-
- Cycle-to-cycle Period Jitter (local)
|
| 116 |
-
- Amplitude Perturbation Shimmer (local)
|
| 117 |
-
- Harmonics-to-Noise Ratio (HNR in dB)
|
| 118 |
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
-
### 3.
|
| 130 |
-
The composite Fluency Index ($0\text{ to }100$) uses empirically chosen heuristic weights:
|
| 131 |
|
| 132 |
-
|
| 133 |
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
---
|
| 137 |
|
| 138 |
-
##
|
| 139 |
|
| 140 |
-
|
|
| 141 |
-
| :--- | :--- | :--- | :--- | :--- |
|
| 142 |
-
| **
|
| 143 |
-
| **
|
| 144 |
-
| **
|
| 145 |
-
| **
|
|
|
|
| 146 |
|
| 147 |
---
|
| 148 |
|
| 149 |
-
##
|
| 150 |
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
| | |-- pron_eval.py # CTC ASR decoding, word alignment, 'r'/'s' flaw rules
|
| 158 |
-
| | |-- fusion.py # Multi-modal fusion, uncertainty, self-calibration
|
| 159 |
-
| | |-- stutter_trainer.py # Wav2Vec2 + LoRA training script with Focal Loss
|
| 160 |
-
| |-- data/
|
| 161 |
-
| | |-- lattice_synth.py # DSP disfluency lattice synthesizer
|
| 162 |
-
| | |-- make_synthetic_dataset.py # Generates 4,000 physical WAV files on disk
|
| 163 |
-
| | |-- download_corpora.py # Downloader and cleaner for UCLASS, SEP-28k, Kisinga
|
| 164 |
-
| | |-- precache_models.py # Docker build pre-cache script
|
| 165 |
-
| |-- cli.py # Unified developer command-line interface
|
| 166 |
-
|-- webapp.py # Streamlit clinical diagnostic user interface
|
| 167 |
-
|-- app.py # Gradio interface for Hugging Face Spaces (ZeroGPU)
|
| 168 |
-
|-- docs/
|
| 169 |
-
| |-- DATASETS_AND_MODEL_GUIDE.md # Plain-English guide to datasets and model design
|
| 170 |
-
| |-- DEPLOY_RENDER.md # Step-by-step Render deployment documentation
|
| 171 |
-
| |-- SETUP.md # Environment setup and dependencies
|
| 172 |
-
|-- data/
|
| 173 |
-
| |-- synthetic_lattice/ # Physical WAV dataset directory
|
| 174 |
-
| |-- metadata/ # Processed Arrow/Parquet datasets
|
| 175 |
-
|-- requirements.txt # Python package dependencies
|
| 176 |
-
|-- Dockerfile # Production container configuration for Render
|
| 177 |
-
|-- render.yaml # Render 1-Click deployment blueprint
|
| 178 |
-
|-- README.md # Transparent research documentation
|
| 179 |
-
```
|
| 180 |
|
| 181 |
---
|
| 182 |
|
| 183 |
-
##
|
| 184 |
-
|
| 185 |
-
The following PowerShell commands allow anyone to clone, set up, and test the entire framework locally on Windows:
|
| 186 |
|
| 187 |
-
### Step 1: Clone Repository and Open PowerShell
|
| 188 |
```powershell
|
| 189 |
-
# Clone the repository
|
| 190 |
git clone https://github.com/notUbaid/speech-model.git
|
| 191 |
-
|
| 192 |
-
# Navigate into the project root directory
|
| 193 |
cd speech-model
|
| 194 |
-
```
|
| 195 |
|
| 196 |
-
#
|
| 197 |
-
```powershell
|
| 198 |
-
# Create a dedicated Python virtual environment
|
| 199 |
python -m venv .venv
|
| 200 |
-
|
| 201 |
-
# If PowerShell script execution is restricted on your machine, enable it for this process:
|
| 202 |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
|
| 203 |
-
|
| 204 |
-
# Activate the virtual environment
|
| 205 |
.\.venv\Scripts\Activate.ps1
|
| 206 |
-
```
|
| 207 |
|
| 208 |
-
#
|
| 209 |
-
```powershell
|
| 210 |
-
# Upgrade pip to the latest version
|
| 211 |
-
python -m pip install --upgrade pip
|
| 212 |
-
|
| 213 |
-
# Install all project requirements
|
| 214 |
pip install -r requirements.txt
|
| 215 |
-
```
|
| 216 |
|
| 217 |
-
#
|
| 218 |
-
|
| 219 |
-
# Execute quick verification for Rhotacism ('r' sound) and Sigmatism ('s' sound)
|
| 220 |
-
python -c @"
|
| 221 |
-
from ml.model import pron_eval
|
| 222 |
-
|
| 223 |
-
# Test 1: Rhotacism ('red' -> 'wed', 'rabbit' -> 'wabbit')
|
| 224 |
-
align_r = pron_eval.align_words('the red rabbit', 'the wed wabbit')
|
| 225 |
-
flaws_r = pron_eval.analyze_speech_flaws('the red rabbit', 'the wed wabbit', align_r, {})
|
| 226 |
-
print('Rhotacism Diagnosis Check: ', 'PASSED' if flaws_r['has_r_flaw'] else 'FAILED')
|
| 227 |
-
|
| 228 |
-
# Test 2: Sigmatism / Lisping ('sun' -> 'thun', 'sweet' -> 'thweet')
|
| 229 |
-
align_s = pron_eval.align_words('the sweet sun', 'the thweet thun')
|
| 230 |
-
flaws_s = pron_eval.analyze_speech_flaws('the sweet sun', 'the thweet thun', align_s, {})
|
| 231 |
-
print('Sigmatism Diagnosis Check:', 'PASSED' if flaws_s['has_s_flaw'] else 'FAILED')
|
| 232 |
-
"@
|
| 233 |
-
```
|
| 234 |
|
| 235 |
-
#
|
| 236 |
-
```powershell
|
| 237 |
-
# Run end-to-end inference against a baseline speech recording
|
| 238 |
-
python -c @"
|
| 239 |
-
from ml.model.engine import SpeechDiagnosticEngine
|
| 240 |
-
|
| 241 |
-
engine = SpeechDiagnosticEngine.get_instance()
|
| 242 |
-
res = engine.diagnose_audio(
|
| 243 |
-
'data/synthetic_lattice/audio/synth_000000_fluent_control.wav',
|
| 244 |
-
'o that like here in the states to beco'
|
| 245 |
-
)
|
| 246 |
-
print('Inference Latency: ', res['latency_ms'], 'ms')
|
| 247 |
-
print('Clinical Assessment: ', res['decision']['buckets']['overall'].upper())
|
| 248 |
-
print('Confidence Level: ', res['decision'].get('confidence', 'N/A'))
|
| 249 |
-
print('Fluency Index: ', res['decision']['fluency_100'], '/ 100')
|
| 250 |
-
print('Decoded Text: ', res['pronunciation']['asr_hypothesis'])
|
| 251 |
-
"@
|
| 252 |
-
```
|
| 253 |
-
|
| 254 |
-
### Step 6: Launch the Interactive Clinical Web Application
|
| 255 |
-
```powershell
|
| 256 |
-
# Start the production Streamlit web service locally
|
| 257 |
streamlit run webapp.py --server.port 8501
|
| 258 |
```
|
| 259 |
|
| 260 |
-
Once
|
| 261 |
-
👉 **`http://localhost:8501`**
|
| 262 |
-
|
| 263 |
-
---
|
| 264 |
-
|
| 265 |
-
### Alternative: Bash / Linux / macOS Commands
|
| 266 |
-
|
| 267 |
-
```bash
|
| 268 |
-
# Setup
|
| 269 |
-
git clone https://github.com/notUbaid/speech-model.git
|
| 270 |
-
cd speech-model
|
| 271 |
-
python3 -m venv .venv
|
| 272 |
-
source .venv/bin/activate
|
| 273 |
-
pip install -r requirements.txt
|
| 274 |
-
|
| 275 |
-
# Run Web Application
|
| 276 |
-
streamlit run webapp.py --server.port 8501
|
| 277 |
-
```
|
|
|
|
| 11 |
|
| 12 |
# Anvaya: Multi-Modal Speech Disfluency & Articulation Screening Prototype
|
| 13 |
|
| 14 |
+
> **CLINICAL & RESEARCH DISCLAIMER**: Anvaya is an exploratory engineering prototype designed for speech screening, acoustic feature exploration, and self-guided practice feedback. It is **not** an FDA-cleared medical device, nor a substitute for formal diagnosis or clinical evaluation by a licensed Speech-Language Pathologist (SLP).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## 1. Abstract & System Architecture
|
| 19 |
|
| 20 |
+
Anvaya explores the integration of fine-tuned self-supervised speech representations (Wav2Vec 2.0 with Low-Rank Adaptation), Connectionist Temporal Classification (CTC) Goodness of Pronunciation (GOP), and acoustic correlates of voice quality extracted via Parselmouth/Praat.
|
| 21 |
|
| 22 |
```
|
| 23 |
===================================================================================
|
|
|
|
| 30 |
| ACOUSTIC SIGNAL PRECONDITIONING |
|
| 31 |
| - Sample Rate: 16,000 Hz Mono Float32 |
|
| 32 |
| - High-Pass Filter: 60 Hz 2nd-Order Butterworth (DC rumble attenuation) |
|
| 33 |
+
| - Dynamic Energy Gate: Silence Guard (RMS & amplitude thresholding) |
|
| 34 |
| - Peak Normalization: Standardized to -1.0 dBFS |
|
| 35 |
+---------------------------------------------------------------------------------+
|
| 36 |
|
|
|
|
|
| 42 |
| Neural Disfluency Classifier | | Phonetic GOP & ASR Alignment |
|
| 43 |
| - Wav2Vec 2.0 Base (768-dim) | | - Wav2Vec 2.0 Base 960h CTC |
|
| 44 |
| - LoRA Adapter (r=8, alpha=16) | | - Needleman-Wunsch DP Alignment |
|
| 45 |
+
| - Focal Loss (gamma=2.0) | | - Phonological Substitution Rules|
|
| 46 |
| Outputs: P(Fluent), P(Stutter) | | Outputs: Word Diffs, GOP Score |
|
| 47 |
+-----------------------------------+ +-----------------------------------+
|
| 48 |
| |
|
|
|
|
| 53 |
v v
|
| 54 |
+-----------------------------------+ +-----------------------------------+
|
| 55 |
| EXPERT MODULE 3: | | EXPERT MODULE 4: |
|
| 56 |
+
| Acoustic-Phonetic Flaw Rules | | Acoustic Correlates of Phonation |
|
| 57 |
| - Rhotic Error Mapping ('r'->'w')| | - Parselmouth / Praat Core |
|
| 58 |
| - Sibilant Lisping ('s'->'th') | | - Pitch Period Tracking (F0) |
|
| 59 |
+
| - Formant Proximity (F3-F2) | | - Local Jitter, Shimmer, HNR |
|
| 60 |
+
| Outputs: Heuristic Flaw Findings | | Outputs: Acoustic Voice Quality |
|
| 61 |
+-----------------------------------+ +-----------------------------------+
|
| 62 |
|
|
| 63 |
v
|
| 64 |
+---------------------------------------------------------------------------------+
|
| 65 |
+
| MULTI-MODAL FUSION & UNCERTAINTY SCORING |
|
| 66 |
| - Heuristic Fluency Index (0 to 100): 40% Stutter, 45% Pronunciation, 15% Voice|
|
| 67 |
+
| - Single-Shift Calibration: Offset applied strictly once at composite rating |
|
| 68 |
| - Uncertainty & Confidence Scoring: Low / Moderate / High |
|
|
|
|
| 69 |
| - Evidence Audit Trail: JSON Telemetry Trace |
|
| 70 |
+---------------------------------------------------------------------------------+
|
| 71 |
```
|
| 72 |
|
| 73 |
---
|
| 74 |
|
| 75 |
+
## 2. Ground-Truth Empirical Evaluation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
Every metric reported below is directly backed by public, auditable JSON files in `reports/ev/`. The evaluation was conducted with **strict out-of-speaker isolation** (test speakers never appeared during training or validation).
|
| 78 |
|
| 79 |
+
### 2.1 Primary Out-of-Speaker Benchmark (`reports/ev/evaluation.json`)
|
| 80 |
+
- **Evaluation Split**: Held-out test partition ($n_{\text{test}} = 1,666$ clips from unseen speakers).
|
| 81 |
+
- **Corpus Type**: Hybrid (Real clinical recordings + synthetic lattices).
|
| 82 |
+
- **Classification Threshold**: $0.50$.
|
| 83 |
|
| 84 |
+
| Metric | Measured Value | Exact Definition | Source File |
|
| 85 |
+
| :--- | :---: | :--- | :--- |
|
| 86 |
+
| **Overall Accuracy** | **71.49%** | Correct classifications / Total test instances | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 87 |
+
| **Macro-F1 Score** | **71.47%** | Unweighted mean of per-class F1 scores | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 88 |
+
| **ROC-AUC** | **0.7605** | Area under the Receiver Operating Characteristic curve | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 89 |
+
| **Stutter Recall (Sensitivity)** | **75.71%** | True Positive Rate ($614 / [614 + 197]$) | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 90 |
+
| **Stutter Precision (PPV)** | **68.83%** | Positive Predictive Value ($614 / [614 + 278]$) | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 91 |
+
| **Fluent Recall (Specificity)** | **67.49%** | True Negative Rate ($577 / [577 + 278]$) | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 92 |
+
| **Fluent Precision** | **74.55%** | $577 / (577 + 197)$ | [`reports/ev/evaluation.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/evaluation.json) |
|
| 93 |
|
| 94 |
+
**Confusion Matrix ($n = 1,666$):**
|
| 95 |
+
```
|
| 96 |
+
Predicted Fluent Predicted Stutter
|
| 97 |
+
Actual Fluent 577 278
|
| 98 |
+
Actual Stutter 197 614
|
| 99 |
+
```
|
| 100 |
|
| 101 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
+
### 2.2 Synthetic-Only Benchmark (`reports/ev/synthetic_eval.json`)
|
| 104 |
+
- **Evaluation Split**: Synthetic held-out test partition ($n_{\text{test}} = 610$ clips).
|
| 105 |
+
- **Classification Threshold**: $0.55$.
|
| 106 |
|
| 107 |
+
| Metric | Measured Value | Source File |
|
| 108 |
+
| :--- | :---: | :--- |
|
| 109 |
+
| **Overall Accuracy** | **68.36%** | [`reports/ev/synthetic_eval.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/synthetic_eval.json) |
|
| 110 |
+
| **Macro-F1 Score** | **64.51%** | [`reports/ev/synthetic_eval.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/synthetic_eval.json) |
|
| 111 |
+
| **ROC-AUC** | **0.7669** | [`reports/ev/synthetic_eval.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/synthetic_eval.json) |
|
| 112 |
+
| **Stutter Precision** | **86.07%** | [`reports/ev/synthetic_eval.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/synthetic_eval.json) |
|
| 113 |
+
| **Stutter Recall** | **68.36%** | [`reports/ev/synthetic_eval.json`](file:///c:/Users/mekha/OneDrive/Desktop/Projects/speech-model/reports/ev/synthetic_eval.json) |
|
| 114 |
|
| 115 |
+
---
|
| 116 |
|
| 117 |
+
### 2.3 Machine-Learned vs. Heuristic Fusion (`reports/ev/fusion.json`)
|
|
|
|
| 118 |
|
| 119 |
+
To evaluate whether a trained classifier could fuse Praat acoustic features and neural predictions, a standard Logistic Regression model was fitted on the feature set ($P(\text{stutter})$, $F_0$, Jitter, Shimmer, HNR, Voiced Ratio):
|
| 120 |
|
| 121 |
+
| Fusion Strategy | Overall Accuracy | Stutter Recall | Macro-F1 | Finding & Rationale |
|
| 122 |
+
| :--- | :---: | :---: | :---: | :--- |
|
| 123 |
+
| **Trained Logistic Regression** | $66.38\%$ | **$4.46\%$** | $43.84\%$ | **Negative Result**: Standard linear fusion defaulted heavily to the majority fluent class, collapsing stutter recall. |
|
| 124 |
+
| **Heuristic Weighted Fusion (Shipped)** | **$71.49\%$** | **$75.71\%$** | **$71.47\%$** | **Preserved Recall**: Bounded heuristic weights maintain sensitivity to clinical disfluency events. |
|
| 125 |
|
| 126 |
---
|
| 127 |
|
| 128 |
+
## 3. Dataset Registry & Provenance
|
| 129 |
|
| 130 |
+
| Dataset | Real/Synthetic | Labeled Domain | Clip Count | Usage in Pipeline |
|
| 131 |
+
| :--- | :--- | :--- | :---: | :--- |
|
| 132 |
+
| **UCLASS** | Authentic Clinical | Clinical stuttered speech monologues | 3,124 | Training, validation, and real clinical test split |
|
| 133 |
+
| **SEP-28k** | Authentic Podcast | Labeled stuttering events from podcast speech | 2,202 | Audio fine-tuning corpus |
|
| 134 |
+
| **LibriStutter** | Semi-Synthetic | Disfluency extensions derived from LibriSpeech | 1,000 | Synthetic extension corpus |
|
| 135 |
+
| **L2-ARCTIC** | Non-Native Real | Multi-accent phonetics and pronunciation | 3,600 | Pronunciation GOP evaluation |
|
| 136 |
+
| **Synthetic Lattices** | DSP Synthesized | Repetitions, prolongations, and glottal blocks | 4,000 | Class balance augmentation (`data/synthetic_lattice/`) |
|
| 137 |
|
| 138 |
---
|
| 139 |
|
| 140 |
+
## 4. Key Engineering & Algorithmic Details
|
| 141 |
|
| 142 |
+
1. **Phonological Alignment Priority**:
|
| 143 |
+
- Explicit clinical substitutions (e.g. `rabbit` $\to$ `wabbit`, `sun` $\to$ `thun`) are evaluated **before** generic Levenshtein phonetic relaxation, ensuring that diagnostic target words are never swallowed by general accent tolerance.
|
| 144 |
+
2. **Single-Shift Calibration**:
|
| 145 |
+
- The user's baseline offset ("My Normal") is applied exactly once at the composite decision level, preventing compounding discounts that could under-score disfluent baselines.
|
| 146 |
+
3. **Acoustic Correlates of Phonation (Praat)**:
|
| 147 |
+
- Voice measurements utilize Parselmouth/Praat PointProcess period tracking ($F_0\text{ median}$, local jitter, local shimmer, HNR). They represent acoustic wave features captured via microphone, not physical endoscopic imaging.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
---
|
| 150 |
|
| 151 |
+
## 5. Quickstart & Local Setup (PowerShell / Windows)
|
|
|
|
|
|
|
| 152 |
|
|
|
|
| 153 |
```powershell
|
| 154 |
+
# 1. Clone the repository
|
| 155 |
git clone https://github.com/notUbaid/speech-model.git
|
|
|
|
|
|
|
| 156 |
cd speech-model
|
|
|
|
| 157 |
|
| 158 |
+
# 2. Set up virtual environment
|
|
|
|
|
|
|
| 159 |
python -m venv .venv
|
|
|
|
|
|
|
| 160 |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
|
|
|
|
|
|
|
| 161 |
.\.venv\Scripts\Activate.ps1
|
|
|
|
| 162 |
|
| 163 |
+
# 3. Install dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
pip install -r requirements.txt
|
|
|
|
| 165 |
|
| 166 |
+
# 4. Run automated self-checks (verifies DSP, Rhotacism, and Sigmatism detection)
|
| 167 |
+
python -m ml.cli self-check
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
+
# 5. Launch web application locally
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
streamlit run webapp.py --server.port 8501
|
| 171 |
```
|
| 172 |
|
| 173 |
+
Once running, open `http://localhost:8501` in your browser.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|