# sayali-mhalaskar/sign-language-detection architecture

> Architecture diagram of the GitHub repository sayali-mhalaskar/sign-language-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sayali-mhalaskar/sign-language-detection
- Repository: https://github.com/sayali-mhalaskar/sign-language-detection

## Overview

This repository supports a webcam-based A–Z sign-recognition workflow and a separate data-preparation/training workflow. In the web app, a browser starts the camera and requests a video stream; frames are converted to hand landmarks, classified, and shown as signs or sentence text. Sentence controls edit the accumulated text. Data can be collected from a webcam or extracted from images, then used to train the classifier. The runtime implementation is in tempCodeRunnerFile.py; README capabilities not visible in that excerpt are retained where documented, but their wiring is not assumed.

Main entry points: [`tempCodeRunnerFile.py`](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py) (Flask application), [`data_collection.py`](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/data_collection.py) (Webcam collector), [`train_model.py`](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/train_model.py) (Classifier trainer), [`to_create_csv.py`](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/to_create_csv.py) (Image landmark export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_collector["Webcam collector<br/>[data_collection.py]"]
  node_image_csv["Image landmark export<br/>[to_create_csv.py]"]
  node_dataset[("Landmark CSV")]
end

subgraph group_training["Model training"]
  node_trainer["Classifier trainer<br/>[train_model.py]"]
  node_classifier[("Trained classifier")]
end

subgraph group_runtime["Recognition runtime"]
  node_landmarks["Hand landmarks"]
  node_inference["Sign classification"]
  node_sentence[("Sentence state")]
end

subgraph group_web["Web interface"]
  node_webapp["Flask application"]
  node_webpage["Recognition page<br/>[index.html]"]
  node_stream["Frame stream"]
  node_controls["Sentence controls"]
end

node_browser(("User browser"))
node_camera(("Webcam"))
node_mediapipe["MediaPipe Hands"]

node_collector -->|"captures frames"| node_camera
node_collector -->|"writes samples"| node_dataset
node_image_csv -->|"writes landmarks"| node_dataset
node_trainer -->|"reads data"| node_dataset
node_trainer -->|"saves model"| node_classifier
node_browser -->|"sends requests"| node_webapp
node_webapp -->|"renders page"| node_webpage
node_webapp -->|"opens camera"| node_camera
node_webapp -->|"serves stream"| node_stream
node_stream -->|"reads frames"| node_camera
node_stream -->|"preprocesses frames"| node_landmarks
node_landmarks -->|"detects hands"| node_mediapipe
node_stream -->|"classifies landmarks"| node_inference
node_inference -->|"runs prediction"| node_classifier
node_stream -->|"updates text"| node_sentence
node_webapp -->|"routes edits"| node_controls
node_controls -->|"edits text"| node_sentence

click node_collector "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/data_collection.py"
click node_image_csv "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/to_create_csv.py"
click node_trainer "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/train_model.py"
click node_webapp "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py"
click node_webpage "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/templates/index.html"
click node_stream "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py"
click node_landmarks "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py"
click node_inference "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py"
click node_sentence "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py"
click node_controls "https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.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_collector,node_image_csv,node_dataset,node_browser toneBlue
class node_trainer,node_classifier toneAmber
class node_landmarks,node_inference,node_sentence,node_mediapipe toneMint
class node_webapp,node_webpage,node_stream,node_controls toneRose
class node_camera toneIndigo
```

## Components

### Data preparation

- [Webcam collector](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/data_collection.py): `data_collection.py`
- [Image landmark export](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/to_create_csv.py): `to_create_csv.py`
- **Landmark CSV**

### Model training

- [Classifier trainer](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/train_model.py): `train_model.py`
- **Trained classifier**

### Recognition runtime

- [Hand landmarks](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`
- [Sign classification](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`
- [Sentence state](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`

### Web interface

- [Flask application](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`
- [Recognition page](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/templates/index.html): `templates/index.html`
- [Frame stream](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`
- [Sentence controls](https://github.com/sayali-mhalaskar/sign-language-detection/blob/main/tempCodeRunnerFile.py): `tempCodeRunnerFile.py`

### Other components

- **User browser**
- **Webcam**
- **MediaPipe Hands**

## Connections

- Webcam collector → Webcam: captures frames (evidence: `data_collection.py`)
- Webcam collector → Landmark CSV: writes samples (evidence: `data_collection.py`)
- Image landmark export → Landmark CSV: writes landmarks (evidence: `to_create_csv.py`)
- Classifier trainer → Landmark CSV: reads data (evidence: `train_model.py`)
- Classifier trainer → Trained classifier: saves model (evidence: `train_model.py`)
- User browser → Flask application: sends requests (evidence: `tempCodeRunnerFile.py`)
- Flask application → Recognition page: renders page (evidence: `tempCodeRunnerFile.py`)
- Flask application → Webcam: opens camera (evidence: `tempCodeRunnerFile.py`)
- Flask application → Frame stream: serves stream (evidence: `tempCodeRunnerFile.py`)
- Frame stream → Webcam: reads frames (evidence: `tempCodeRunnerFile.py`)
- Frame stream → Hand landmarks: preprocesses frames (evidence: `tempCodeRunnerFile.py`)
- Hand landmarks → MediaPipe Hands: detects hands (evidence: `tempCodeRunnerFile.py`)
- Frame stream → Sign classification: classifies landmarks (evidence: `tempCodeRunnerFile.py`)
- Sign classification → Trained classifier: runs prediction (evidence: `tempCodeRunnerFile.py`)
- Frame stream → Sentence state: updates text (evidence: `tempCodeRunnerFile.py`)
- Flask application → Sentence controls: routes edits (evidence: `tempCodeRunnerFile.py`)
- Sentence controls → Sentence state: edits text (evidence: `tempCodeRunnerFile.py`)
