# kumar-shivam-ranjan/slurred-speech-recognition-deeplearning architecture

> Architecture diagram of the GitHub repository kumar-shivam-ranjan/slurred-speech-recognition-deeplearning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning
- Repository: https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning

## Overview

##### Project Type & Purpose
- This is a Deep Learning pipeline for Automatic Speech Recognition (ASR), focused on fine-tuning a high-accuracy base ASR model on “slurred” speech (speech impairments). It consists primarily of data collection, preprocessing, training (base + transfer-learning), and evaluation components.

##### File Structure Analysis
- Top‐level directories:
- Best-Fit-TrainedModel – holds trained Keras/TensorFlow .h5 model checkpoints (base & fine-tuned).
- Dataset – FLAC audio files organized by speaker and transfer-learning subsets, plus simple test.py scripts.
- Notebooks Code – Jupyter notebooks where feature extraction, model definitions, training loops, and analysis happen.
- Papers & Project_Update_Reports – reference docs.
- No monolithic “src” folder; code lives in notebooks and small Python scripts for testing.

##### Key README Insights
- Base model: end-to-end ASR (DeepSpeech-style).
- Workflow: train base on large standard speech corpus → fine-tune via transfer learning on small impaired speech dataset.
- Uses Django web app (external component) for impaired speech collection.

##### Main Components & Interactions
A. External Data Sources
1. Standard Speech Dataset (e.g., Librispeech)
2. Impaired Speech Collection Web App (Django on Heroku + static GitHub Pages)
B. Data Storage
- Raw audio (FLAC) in Dataset/…
- Transcripts (.txt) alongside audio
C. Preprocessing & Feature Extraction
- Notebooks and test.py scripts that convert FLAC to spectrogram/MFCC tensors
D. Model Training
1. Base Model Training
- Input: preprocessed standard speech features → DeepSpeech-style network → checkpoints in Best-Fit-TrainedModel
2. Transfer Learning / Fine-Tuning
- Input: small impaired speech features + base checkpoints → fine-tune selective layers → new .h5 in Best-Fit-TrainedModel
E. Evaluation & Prediction
- Jupyter notebooks produce metrics (CER/WER), save prediction.txt
F. Reporting & Documentation
- Papers/… and Project_Update_Reports/… guide design choices

##### Architectural Patterns & Principles
- Pipeline Architecture: clear stage separation (Ingestion → Preprocessing → Training → Evaluation).
- Transfer Learning Pattern: reuse base model weights, freeze/unfreeze layers for personalized fine-tuning.
- Notebook-driven development: experimentation decoupled from production pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Services
    subgraph "External Data Sources"
        A_SD["Standard Speech Dataset"]:::external
        A_WEB["Data Collection Web App\n(Django/Heroku)"]:::external
    end

    %% Storage
    C1["Standard Speech Raw FLAC Storage"]:::storage
    C2["Impaired Speech Raw FLAC Storage"]:::storage
    D1["Standard Transcripts Storage"]:::storage
    D2["Impaired Transcripts Storage"]:::storage

    %% Preprocessing Notebooks & Scripts
    N1["BTP Part1.ipynb"]:::compute
    N2["BTP_English.ipynb"]:::compute
    S1["test.py (Train)"]:::compute
    S2["test.py (Test)"]:::compute

    %% Feature Merge
    FE["Preprocessed Features\n(spectrogram/MFCC tensors)"]:::compute

    %% Base Model Training
    T1["BTP Part2.ipynb"]:::compute
    T2["BTP__Hindi.ipynb"]:::compute
    M1["Base Model Checkpoints\n(.h5)"]:::storage

    %% Fine-Tuning
    FT["BTP_final.ipynb"]:::compute
    M2["Fine-Tuned Model Checkpoints\n(.h5)"]:::storage

    %% Evaluation & Reporting
    EV["Evaluation & Prediction\n(CER/WER, prediction.txt)"]:::compute
    R1["DeepSpeech.pdf"]:::output
    R2["BTP Project Update-1.pdf"]:::output

    %% Data Flow
    A_SD -->|"FLAC audio"| C1
    A_WEB -->|"FLAC audio"| C2
    C1 -->|"transcripts .txt"| D1
    C2 -->|"transcripts .txt"| D2

    C1 -->|"FLAC files"| N1
    C1 -->|"FLAC files"| N2
    C2 -->|"FLAC files"| N1
    C2 -->|"FLAC files"| N2
    C1 -->|"FLAC files"| S1
    C2 -->|"FLAC files"| S2

    N1 -->|"spectrogram tensors"| FE
    N2 -->|"spectrogram tensors"| FE
    S1 -->|"spectrogram tensors"| FE
    S2 -->|"spectrogram tensors"| FE

    FE -->|"standard features"| T1
    FE -->|"standard features"| T2
    T1 -->|"checkpoint .h5"| M1
    T2 -->|"checkpoint .h5"| M1

    M1 -->|"base .h5 + impaired features"| FT
    FE -->|"impaired features"| FT
    FT -->|"fine-tuned .h5"| M2

    M2 -->|"model .h5"| EV
    EV -->|"prediction.txt"| R1
    EV -->|"prediction.txt"| R2

    %% Click Events
    click C1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/tree/main/Dataset/SlurredSpeech-Dataset-Train(Hindi)"
    click C2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/tree/main/Dataset/SlurredSpeech-Dataset-Test(Hindi)"
    click D1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Dataset/SlurredSpeech-Dataset-Train(Hindi)/1/2/1-2.trans.txt"
    click D2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Dataset/SlurredSpeech-Dataset-Test(Hindi)/1/2/1-2.trans.txt"
    click N1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Notebooks Code/BTP Part1.ipynb"
    click N2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Notebooks Code/BTP_English.ipynb"
    click S1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Dataset/SlurredSpeech-Dataset-Train(Hindi)/1/2/test.py"
    click S2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Dataset/SlurredSpeech-Dataset-Test(Hindi)/1/2/test.py"
    click T1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Notebooks Code/BTP Part2.ipynb"
    click T2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Notebooks Code/BTP__Hindi.ipynb"
    click M1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/tree/main/Best-Fit-TrainedModel"
    click FT "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Notebooks Code/BTP_final.ipynb"
    click M2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/tree/main/Best-Fit-TrainedModel"
    click EV "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/prediction.txt"
    click R1 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Papers/DeepSpeech.pdf"
    click R2 "https://github.com/kumar-shivam-ranjan/slurred-speech-recognition-deeplearning/blob/main/Project_Update_Reports/BTP Project Update-1.pdf"

    %% Styles
    classDef storage fill:#blue,stroke:#000,color:#fff
    classDef compute fill:#0f0,stroke:#000,color:#000
    classDef external fill:#aaa,stroke:#000,color:#000
    classDef output fill:#f90,stroke:#000,color:#000
```
