# divya-a10/infant-cry-ai architecture

> Architecture diagram of the GitHub repository divya-a10/infant-cry-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divya-a10/infant-cry-ai
- Repository: https://github.com/divya-a10/infant-cry-ai

## Overview

The product is a Streamlit infant-cry classifier: a caregiver uploads a WAV file, the system processes audio, predicts a cry category, and presents confidence and uncertainty explanations. The README documents VAD, mel-spectrogram extraction, Grad-CAM visualization, and severity scoring; several of those modules were not sampled, so their connections are shown only where the README specifies them. The dashboard excerpt confirms model loading and inference, but its audio preprocessing is partly inline, so the documented processing stages should not be read as proof of separate runtime calls.

Main entry points: [`app/dashboard.py`](https://github.com/divya-a10/infant-cry-ai/blob/main/app/dashboard.py) (Streamlit dashboard), [`src/models/cnn_crnn.py`](https://github.com/divya-a10/infant-cry-ai/blob/main/src/models/cnn_crnn.py) (CNN–CRNN classifier), [`src/preprocessing/vad.py`](https://github.com/divya-a10/infant-cry-ai/blob/main/src/preprocessing/vad.py) (Voice activity detection), [`src/features/spectrogram.py`](https://github.com/divya-a10/infant-cry-ai/blob/main/src/features/spectrogram.py) (Mel spectrogram)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Caregiver interface"]
  node_dashboard["Streamlit dashboard<br/>[dashboard.py]"]
end

subgraph group_audio["Audio analysis"]
  node_vad["Voice activity detection<br/>[vad.py]"]
  node_spectrogram["Mel spectrogram<br/>[spectrogram.py]"]
  node_model["CNN–CRNN classifier<br/>[cnn_crnn.py]"]
  node_checkpoint["Trained weights"]
end

subgraph group_insight["Prediction insights"]
  node_uncertainty["Uncertainty assessment<br/>[dashboard.py]"]
  node_gradcam["Grad-CAM visualization<br/>[gradcam.py]"]
  node_severity["Cry severity score<br/>[severity_index.py]"]
end

node_caregiver(("Caregiver"))

node_caregiver -->|"uploads WAV"| node_dashboard
node_dashboard -->|"processes audio"| node_vad
node_vad -->|"segments audio"| node_spectrogram
node_spectrogram -->|"provides features"| node_model
node_dashboard -->|"runs inference"| node_model
node_dashboard -->|"loads weights"| node_checkpoint
node_dashboard -->|"checks probabilities"| node_uncertainty
node_model -.->|"explains prediction"| node_gradcam
node_model -.->|"scores cry"| node_severity

click node_dashboard "https://github.com/divya-a10/infant-cry-ai/blob/main/app/dashboard.py"
click node_vad "https://github.com/divya-a10/infant-cry-ai/blob/main/src/preprocessing/vad.py"
click node_spectrogram "https://github.com/divya-a10/infant-cry-ai/blob/main/src/features/spectrogram.py"
click node_model "https://github.com/divya-a10/infant-cry-ai/blob/main/src/models/cnn_crnn.py"
click node_checkpoint "https://github.com/divya-a10/infant-cry-ai/blob/main/cry_model_updated.pth"
click node_uncertainty "https://github.com/divya-a10/infant-cry-ai/blob/main/app/dashboard.py"
click node_gradcam "https://github.com/divya-a10/infant-cry-ai/blob/main/src/explainability/gradcam.py"
click node_severity "https://github.com/divya-a10/infant-cry-ai/blob/main/src/severity/severity_index.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard toneBlue
class node_vad,node_spectrogram,node_model,node_checkpoint toneAmber
class node_uncertainty,node_gradcam,node_severity toneMint
class node_caregiver toneIndigo
```

## Components

### Caregiver interface

- [Streamlit dashboard](https://github.com/divya-a10/infant-cry-ai/blob/main/app/dashboard.py): `app/dashboard.py`

### Audio analysis

- [Voice activity detection](https://github.com/divya-a10/infant-cry-ai/blob/main/src/preprocessing/vad.py): `src/preprocessing/vad.py`
- [Mel spectrogram](https://github.com/divya-a10/infant-cry-ai/blob/main/src/features/spectrogram.py): `src/features/spectrogram.py`
- [CNN–CRNN classifier](https://github.com/divya-a10/infant-cry-ai/blob/main/src/models/cnn_crnn.py): `src/models/cnn_crnn.py`
- [Trained weights](https://github.com/divya-a10/infant-cry-ai/blob/main/cry_model_updated.pth): `cry_model_updated.pth`

### Prediction insights

- [Uncertainty assessment](https://github.com/divya-a10/infant-cry-ai/blob/main/app/dashboard.py): `app/dashboard.py`
- [Grad-CAM visualization](https://github.com/divya-a10/infant-cry-ai/blob/main/src/explainability/gradcam.py): `src/explainability/gradcam.py`
- [Cry severity score](https://github.com/divya-a10/infant-cry-ai/blob/main/src/severity/severity_index.py): `src/severity/severity_index.py`

### Other components

- **Caregiver**

## Connections

- Caregiver → Streamlit dashboard: uploads WAV (evidence: `README.md`)
- Streamlit dashboard → Voice activity detection: processes audio (evidence: `README.md`)
- Voice activity detection → Mel spectrogram: segments audio (evidence: `README.md`)
- Mel spectrogram → CNN–CRNN classifier: provides features (evidence: `README.md`)
- Streamlit dashboard → CNN–CRNN classifier: runs inference (evidence: `app/dashboard.py`)
- Streamlit dashboard → Trained weights: loads weights (evidence: `app/dashboard.py`)
- Streamlit dashboard → Uncertainty assessment: checks probabilities (evidence: `app/dashboard.py`)
- CNN–CRNN classifier → Grad-CAM visualization: explains prediction
- CNN–CRNN classifier → Cry severity score: scores cry
