CoolFace
Apppublic

arshadykbk2/Child-Speech-Emotion-Recognition

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes
App README

๐ŸŽ™๏ธ Child Speech Emotion Recognition (SER) System

A SOTA Deep Learning & Healthcare Platform for Automated Child Vocal Emotion Classification Built with Microsoft WavLM Transformer, 1D Residual CNNs, Attention Pooling, and FastAPI.

๐ŸŒŸ Executive Summary

This project implements a state-of-the-art Child Speech Emotion Recognition (SER) System designed for clinical healthcare assessment, developmental psychology research, and academic demonstration.

The system classifies child vocalizations into 6 distinct emotion classes:

  • โ€”๐Ÿ˜ƒ Happy
  • โ€”๐Ÿ˜ข Sad
  • โ€”๐Ÿ˜ก Angry
  • โ€”๐Ÿ˜จ Fear
  • โ€”๐Ÿ˜ Neutral
  • โ€”๐Ÿคข Disgust

๐Ÿ“Š Key Performance Metrics

The model was evaluated on the independent test dataset, achieving state-of-the-art classification performance:

MetricScore
Validation Accuracy97.18%
F1-Score (Macro)97.14%
Recall (Macro)97.24%
Precision (Macro)97.06%
Average ROC-AUC0.99

๐Ÿ—๏ธ Neural Network Architecture

text
Input Audio (16kHz PCM Signal)
          โ”‚
          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Microsoft WavLM Base (768-dim Acoustic)    โ”‚  <-- Pre-trained Transformer Encoder
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  1D Residual CNN (3 Residual Blocks)         โ”‚  <-- Local Temporal Feature Extraction
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Attention Pooling Mechanism                 โ”‚  <-- Dynamic Time-Frame Weighting
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Linear Classification Head (6 Classes)      โ”‚  <-- Softmax Probability Distribution
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start Guide (Offline Desktop Software)

๐Ÿ On Mac:

  1. 1.Double-click `RUN_OFFLINE_MAC.command`.
  2. 2.Safari/Chrome will open automatically to http://localhost:8000.

๐ŸชŸ On Windows:

  1. 1.Double-click `RUN_OFFLINE_WINDOWS.bat`.
  2. 2.Chrome/Edge will open automatically to http://localhost:8000.

โ˜๏ธ Hugging Face Cloud Deployment

This project is pre-configured for 1-click hosting on Hugging Face Spaces:

  1. 1.Create a new Space on Hugging Face (SDK: Docker $\rightarrow$ Blank).
  2. 2.Upload the project files or push via Git CLI:
bash
   git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
   cd YOUR_SPACE_NAME
   cp -r /path/to/project/* .
   git add .
   git commit -m "Deploy Child Emotion AI Web App"
   git push

๐Ÿ“ Repository Directory Structure

text
โ”œโ”€โ”€ RUN_OFFLINE_MAC.command       # 1-Click Mac Executable Launcher
โ”œโ”€โ”€ RUN_OFFLINE_WINDOWS.bat       # 1-Click Windows Executable Launcher
โ”œโ”€โ”€ Dockerfile                    # Containerization manifest for Cloud Deployment
โ”œโ”€โ”€ server.py                     # FastAPI Backend Inference Server
โ”œโ”€โ”€ index.html                    # Commercial React + Tailwind Healthcare UI
โ”œโ”€โ”€ config.py                     # System Parameters & Hyperparameters
โ”œโ”€โ”€ requirements.txt              # Python Dependencies List
โ”œโ”€โ”€ OFFLINE_APP_INSTRUCTIONS.md   # User Guide for Offline Executables
โ”‚
โ”œโ”€โ”€ models/                       # Neural Network Architectures
โ”‚   โ”œโ”€โ”€ wavlm_classifier.py       # WavLM Base Foundation Model
โ”‚   โ”œโ”€โ”€ cnn.py                    # 1D Residual Convolutional Layers
โ”‚   โ””โ”€โ”€ attention.py              # Attention Pooling Mechanism
โ”‚
โ”œโ”€โ”€ dataset/                      # Data Processing & Loader Pipeline
โ”‚   โ”œโ”€โ”€ parser.py                 # Audio Parser & Label Extractor
โ”‚   โ”œโ”€โ”€ loader.py                 # PyTorch DataLoader & Collate Logic
โ”‚   โ””โ”€โ”€ preprocessing.py          # 16kHz Resampling & Normalization
โ”‚
โ”œโ”€โ”€ training/                     # Model Training Engine
โ”‚   โ”œโ”€โ”€ trainer.py                # Trainer Class with AMP & Early Stopping
โ”‚   โ”œโ”€โ”€ losses.py                 # CrossEntropy & Focal Loss Functions
โ”‚   โ””โ”€โ”€ metrics.py                # F1, Precision, Recall, ROC-AUC Computations
โ”‚
โ”œโ”€โ”€ utils/                        # Utility Helpers
โ”‚   โ”œโ”€โ”€ checkpoints.py            # Model Checkpoint Saver/Loader
โ”‚   โ””โ”€โ”€ seed.py                   # Reproducibility Seed Manager
โ”‚
โ””โ”€โ”€ outputs/                      # Trained Artifacts & Weights
    โ”œโ”€โ”€ label_mapping.json        # Class Index Mapping
    โ””โ”€โ”€ checkpoints/
        โ””โ”€โ”€ emotion_model.pth     # 385 MB Trained Checkpoint (97.18% Accuracy)

๐Ÿ“„ License & Attribution

  • โ€”Developed for: B.Tech Final-Year Capstone Project & Healthcare Deliverable.
  • โ€”Dataset: Child Speech Emotion Dataset (C-BESD).
  • โ€”Frameworks: PyTorch, Transformers, FastAPI, Tailwind CSS.