Skip to content

MsMarion/ASL-Fun-Training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

101 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸคŸ SignHero

A real-time American Sign Language (ASL) learning platform combining rhythm-based gaming with AI-powered hand sign recognition.

SignHero


๐ŸŒŸ Overview

SignHero is a full-stack application that teaches ASL fingerspelling through interactive gameplay. The system uses a webcam to detect hand signs in real-time via a trained machine learning model, then challenges players to sign along to beatmaps synced with musicโ€”like Guitar Hero, but with sign language.

Component Description
Frontend Game (asl/) Next.js 15 web app with rhythm game modes, visual effects, and real-time scoring
ML Backend (Base test/) PyTorch model (MobileNetV2) trained on ASL alphabet data
API Server (api_server_http.py) FastAPI server for real-time sign prediction via webcam frames

๐ŸŽฎ Features

Game Modes

  • Song Game โ€” Rhythm-based gameplay with scrolling note highway and combo scoring
  • Training Mode โ€” Step-by-step practice with visual hand pose hints
  • Testing Mode โ€” Timed challenges with accuracy tracking
  • Whack-A-Sign โ€” Arcade-style reflex game

AI Sign Detection

  • Real-time webcam analysis using MediaPipe hand tracking
  • MobileNetV2 CNN for letter classification (A-Z)
  • ~30-50ms inference latency on localhost

Visual & Audio

  • Synthwave aesthetic with neon effects
  • Particle bursts, screen flash, streak glow
  • Sound effects for hits/misses

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    User's Browser                        โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚ Next.js Game (asl/)                                 โ”‚โ”‚
โ”‚  โ”‚  โ€ข GameCanvas โ€ข NoteHighway โ€ข WebcamFeed            โ”‚โ”‚
โ”‚  โ”‚  โ€ข useGameLoop โ€ข useSignDetection โ€ข useWebcam       โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚ HTTP POST /predict_frame
                            โ”‚ (JPEG + timestamp)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        FastAPI Server (api_server_http.py)              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚ ASLPredictor                                       โ”‚ โ”‚
โ”‚  โ”‚  1. Decode JPEG (cv2)                              โ”‚ โ”‚
โ”‚  โ”‚  2. Hand Detection (MediaPipe)                     โ”‚ โ”‚
โ”‚  โ”‚  3. Feature Extraction (landmark mask)             โ”‚ โ”‚
โ”‚  โ”‚  4. CNN Inference (PyTorch MobileNetV2)            โ”‚ โ”‚
โ”‚  โ”‚  5. Return {letter, confidence, handDetected}      โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

See ARCHITECTURE.md for detailed system diagrams.


๐Ÿ“ Project Structure

ASL-Fun-Training/
โ”‚
โ”œโ”€โ”€ asl/                              # ๐ŸŽฎ Next.js Frontend Application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/                      # App Router pages (game, training, testing)
โ”‚   โ”‚   โ”œโ”€โ”€ components/game/          # GameCanvas, NoteHighway, effects
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/                    # useGameLoop, useSignDetection, useWebcam
โ”‚   โ”‚   โ””โ”€โ”€ lib/                      # Scoring, beatmaps, utilities
โ”‚   โ””โ”€โ”€ README.md                     # Frontend-specific docs
โ”‚
โ”œโ”€โ”€ Base test/Sign-Language-Recognition/  # ๐Ÿง  ML Training & Model
โ”‚   โ”œโ”€โ”€ app/                          # API & frame extraction scripts
โ”‚   โ”œโ”€โ”€ model/                        # CNN architecture (MobileNetV2)
โ”‚   โ”œโ”€โ”€ train/                        # Training scripts
โ”‚   โ”œโ”€โ”€ data/weights/                 # Trained model weights (.pth)
โ”‚   โ””โ”€โ”€ utils/                        # Label mapping, model loading
โ”‚
โ”œโ”€โ”€ api_server_http.py                # ๐Ÿš€ FastAPI prediction server
โ”œโ”€โ”€ api_server_mock.py                # Mock server for testing
โ”œโ”€โ”€ start-servers.sh                  # One-click startup (Unix)
โ”œโ”€โ”€ start-servers.bat                 # One-click startup (Windows)
โ”‚
โ”œโ”€โ”€ models/                           # Additional model storage
โ”œโ”€โ”€ training/                         # Training data/scripts
โ”œโ”€โ”€ dataset/                          # Raw dataset
โ”œโ”€โ”€ asset_generation/                 # Hand sign SVG assets
โ”‚
โ”œโ”€โ”€ ARCHITECTURE.md                   # System architecture diagrams
โ”œโ”€โ”€ INTEGRATION_GUIDE.md              # Full integration documentation
โ”œโ”€โ”€ QUICKSTART_INTEGRATION.md         # Quick setup guide
โ””โ”€โ”€ SETUP.md                          # Environment setup

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.10+ with pip
  • Node.js 20+ with pnpm
  • MongoDB instance
  • Webcam for sign detection

1. Start the ML Server

# Navigate to project root
cd ASL-Fun-Training

# Create Python virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install torch torchvision opencv-python mediapipe fastapi uvicorn python-multipart

# Start the API server
python api_server_http.py
# Server runs at http://localhost:8000

2. Start the Frontend

# In a new terminal
cd asl

# Install dependencies
pnpm install

# Set up environment
cp .env.example .env
# Edit .env with MongoDB URI

# Start dev server
pnpm dev
# App runs at http://localhost:3000

One-Click Startup

# Unix/Mac
./start-servers.sh

# Windows
start-servers.bat

๐Ÿ› ๏ธ Tech Stack

Frontend (asl/)

Tech Purpose
Next.js 15 React framework (App Router, Turbopack)
TypeScript Type safety
Tailwind CSS 4 Styling
Framer Motion Animations
tRPC Type-safe API layer
Prisma + MongoDB Database

Backend (Base test/ + api_server_http.py)

Tech Purpose
FastAPI HTTP API server
PyTorch Deep learning framework
MobileNetV2 CNN architecture for classification
MediaPipe Hand landmark detection
OpenCV Image processing

๐Ÿง  Model Training

The sign detection model is a MobileNetV2 trained on hand landmark features:

Input: 224ร—224 RGB image (hand feature mask)
  โ†“
MobileNetV2 CNN
  โ†“
Output: 26 classes (A-Z)

Training Pipeline:

  1. Webcam captures hand images
  2. MediaPipe extracts 21 hand landmarks
  3. Landmarks drawn as feature mask on black background
  4. Both original and mirrored images processed
  5. Max confidence from both used for prediction

Model weights: Base test/Sign-Language-Recognition/data/weights/asl_crop_v4_1_mobilenet_weights.pth


๐Ÿ“š Documentation

Document Description
ARCHITECTURE.md System diagrams, data flow, timing model
INTEGRATION_GUIDE.md Full integration documentation
QUICKSTART_INTEGRATION.md 5-minute setup guide
SETUP.md Environment configuration
asl/README.md Frontend-specific documentation

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“„ License

Educational project for ASL learning.


๐Ÿ™ Acknowledgments

  • T3 Stack for the Next.js template
  • MediaPipe for hand tracking
  • ASL fingerspelling resources for training data

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published