# winac2/signlang_test architecture

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

- Interactive diagram: https://gitdiagram.com/winac2/signlang_test
- Repository: https://github.com/winac2/signlang_test

## Overview

SignMachine is a desktop sign-gesture recognition app plus a dataset-to-model workflow. In the main user path, a person starts the webcam, the app detects and classifies a hand gesture, and sustained predictions become translated message text that can be spoken. The separate preparation path extracts and preprocesses image landmarks before training a classifier; evaluation scripts assess model results. Runtime relationships are grounded in the app and language-module excerpts, while preparation and evaluation links follow their shown file reads and writes. Other model artifacts are listed in the tree but their roles were not inspected.

Main entry points: [`hand_gesture_app.py`](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py) (Gesture app), [`models`](https://github.com/winac2/signlang_test/tree/main/models) (Saved model files), [`lang/lang_mana.py`](https://github.com/winac2/signlang_test/blob/main/lang/lang_mana.py) (Language manager), [`collect_data_from_images.py`](https://github.com/winac2/signlang_test/blob/main/collect_data_from_images.py) (Image landmark extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Recognition App"]
  node_app["Gesture app"]
  node_detection["Hand detection"]
  node_features["Landmark features"]
  node_classifier["Gesture classifier"]
  node_message["Message composition"]
end

subgraph group_language["Language and Output"]
  node_language_manager["Language manager<br/>[lang_mana.py]"]
  node_english_text["English translations<br/>[EN.py]"]
  node_vietnamese_text["Vietnamese translations<br/>[VI.py]"]
  node_speech["Speech output"]
end

subgraph group_data["Dataset Preparation"]
  node_image_dataset["Labeled images"]
  node_image_collection["Image landmark extraction"]
  node_preprocessing["Landmark preprocessing<br/>[preprocess_data.py]"]
  node_csv_data["Processed CSV"]
end

subgraph group_learning["Model and Evaluation"]
  node_training["Random forest training"]
  node_model_store[("Saved model files")]
  node_model_evaluation["ROC evaluation<br/>[model_evaluate.py]"]
  node_confusion_eval["Confusion evaluation"]
end

node_user(("App user"))
node_camera["Webcam"]

node_user -->|"operates"| node_app
node_camera -->|"provides frames"| node_app
node_app -->|"processes frames"| node_detection
node_detection -->|"extracts landmarks"| node_features
node_features -->|"predicts gesture"| node_classifier
node_app -->|"commits gesture"| node_message
node_app -->|"translates text"| node_language_manager
node_language_manager -->|"uses"| node_english_text
node_language_manager -->|"uses"| node_vietnamese_text
node_user -->|"requests speech"| node_app
node_app -->|"speaks message"| node_speech
node_image_dataset -->|"supplies images"| node_image_collection
node_image_dataset -->|"supplies images"| node_preprocessing
node_image_collection -->|"writes landmarks"| node_csv_data
node_preprocessing -->|"writes processed data"| node_csv_data
node_csv_data -->|"loads features"| node_training
node_training -->|"saves classifier"| node_model_store
node_model_store -->|"loads model"| node_classifier
node_model_store -->|"loads model"| node_model_evaluation
node_model_store -->|"loads model"| node_confusion_eval
node_csv_data -->|"supplies test data"| node_model_evaluation
node_csv_data -->|"supplies test data"| node_confusion_eval

click node_app "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_detection "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_features "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_classifier "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_message "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_language_manager "https://github.com/winac2/signlang_test/blob/main/lang/lang_mana.py"
click node_english_text "https://github.com/winac2/signlang_test/blob/main/lang/EN.py"
click node_vietnamese_text "https://github.com/winac2/signlang_test/blob/main/lang/VI.py"
click node_speech "https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py"
click node_image_collection "https://github.com/winac2/signlang_test/blob/main/collect_data_from_images.py"
click node_preprocessing "https://github.com/winac2/signlang_test/blob/main/preprocess_data.py"
click node_training "https://github.com/winac2/signlang_test/blob/main/train_hand_model.py"
click node_model_store "https://github.com/winac2/signlang_test/tree/main/models"
click node_model_evaluation "https://github.com/winac2/signlang_test/blob/main/model_evaluate.py"
click node_confusion_eval "https://github.com/winac2/signlang_test/blob/main/confusion_matrix.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_app,node_detection,node_features,node_classifier,node_message,node_user toneBlue
class node_language_manager,node_english_text,node_vietnamese_text,node_speech toneAmber
class node_image_dataset,node_image_collection,node_preprocessing,node_csv_data toneMint
class node_training,node_model_store,node_model_evaluation,node_confusion_eval toneRose
class node_camera toneIndigo
```

## Components

### Recognition App

- [Gesture app](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`
- [Hand detection](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`
- [Landmark features](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`
- [Gesture classifier](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`
- [Message composition](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`

### Language and Output

- [Language manager](https://github.com/winac2/signlang_test/blob/main/lang/lang_mana.py): `lang/lang_mana.py`
- [English translations](https://github.com/winac2/signlang_test/blob/main/lang/EN.py): `lang/EN.py`
- [Vietnamese translations](https://github.com/winac2/signlang_test/blob/main/lang/VI.py): `lang/VI.py`
- [Speech output](https://github.com/winac2/signlang_test/blob/main/hand_gesture_app.py): `hand_gesture_app.py`

### Dataset Preparation

- **Labeled images**
- [Image landmark extraction](https://github.com/winac2/signlang_test/blob/main/collect_data_from_images.py): `collect_data_from_images.py`
- [Landmark preprocessing](https://github.com/winac2/signlang_test/blob/main/preprocess_data.py): `preprocess_data.py`
- **Processed CSV**

### Model and Evaluation

- [Random forest training](https://github.com/winac2/signlang_test/blob/main/train_hand_model.py): `train_hand_model.py`
- [Saved model files](https://github.com/winac2/signlang_test/tree/main/models): `models`
- [ROC evaluation](https://github.com/winac2/signlang_test/blob/main/model_evaluate.py): `model_evaluate.py`
- [Confusion evaluation](https://github.com/winac2/signlang_test/blob/main/confusion_matrix.py): `confusion_matrix.py`

### Other components

- **App user**
- **Webcam**

## Connections

- App user → Gesture app: operates (evidence: `README.md`)
- Webcam → Gesture app: provides frames (evidence: `README.md`)
- Gesture app → Hand detection: processes frames (evidence: `hand_gesture_app.py`)
- Hand detection → Landmark features: extracts landmarks (evidence: `hand_gesture_app.py`)
- Landmark features → Gesture classifier: predicts gesture (evidence: `hand_gesture_app.py`)
- Gesture app → Message composition: commits gesture (evidence: `hand_gesture_app.py`)
- Gesture app → Language manager: translates text (evidence: `hand_gesture_app.py`)
- Language manager → English translations: uses (evidence: `lang/lang_mana.py`)
- Language manager → Vietnamese translations: uses (evidence: `lang/lang_mana.py`)
- App user → Gesture app: requests speech (evidence: `hand_gesture_app.py`)
- Gesture app → Speech output: speaks message (evidence: `hand_gesture_app.py`)
- Labeled images → Image landmark extraction: supplies images (evidence: `collect_data_from_images.py`)
- Labeled images → Landmark preprocessing: supplies images (evidence: `preprocess_data.py`)
- Image landmark extraction → Processed CSV: writes landmarks (evidence: `collect_data_from_images.py`)
- Landmark preprocessing → Processed CSV: writes processed data (evidence: `preprocess_data.py`)
- Processed CSV → Random forest training: loads features (evidence: `train_hand_model.py`)
- Random forest training → Saved model files: saves classifier (evidence: `train_hand_model.py`)
- Saved model files → Gesture classifier: loads model (evidence: `hand_gesture_app.py`)
- Saved model files → ROC evaluation: loads model (evidence: `model_evaluate.py`)
- Saved model files → Confusion evaluation: loads model (evidence: `confusion_matrix.py`)
- Processed CSV → ROC evaluation: supplies test data (evidence: `model_evaluate.py`)
- Processed CSV → Confusion evaluation: supplies test data (evidence: `confusion_matrix.py`)
