# lenguyen1726/khdl architecture

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

- Interactive diagram: https://gitdiagram.com/lenguyen1726/khdl
- Repository: https://github.com/lenguyen1726/khdl

## Overview

This repository implements a desktop ASL alphabet-to-text application, alongside scripts for collecting landmark samples, preparing Kaggle landmarks, and training classifiers. The live application captures webcam frames, detects and normalizes hand landmarks, classifies them with a Transformer, and provides text-entry and spelling-suggestion controls. The training scripts cover both Transformer and standard ExtraTrees models, with evaluation outputs. The README is empty, so capability descriptions rely on the sampled code; omitted source limits confirmation of some internal call paths.

Main entry points: [`train_landmark_transformer.py`](https://github.com/lenguyen1726/khdl/blob/main/train_landmark_transformer.py) (Transformer training), [`Application.py`](https://github.com/lenguyen1726/khdl/blob/main/Application.py) (Desktop application), [`train_landmark_model_standard.py`](https://github.com/lenguyen1726/khdl/blob/main/train_landmark_model_standard.py) (Standard model training), [`landmark_transformer_model.py`](https://github.com/lenguyen1726/khdl/blob/main/landmark_transformer_model.py) (Landmark Transformer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live sign-to-text"]
  node_application["Desktop application<br/>[Application.py]"]
  node_landmark_model["Landmark Transformer"]
end

subgraph group_data["Landmark data"]
  node_custom_collector["Custom sample collector"]
  node_kaggle_preparer["Kaggle landmark preparation"]
  node_landmark_data[("Landmark datasets")]
end

subgraph group_training["Model training"]
  node_transformer_training["Transformer training"]
  node_standard_training["Standard model training"]
  node_model_artifacts[("Trained model artifacts")]
  node_evaluation["Evaluation outputs"]
  node_model_testing["Kaggle model test"]
end

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

node_webcam -->|"supplies frames"| node_application
node_application -->|"runs inference"| node_landmark_model
node_application -.->|"shows text"| node_user
node_user -.->|"controls text"| node_application
node_custom_collector -->|"writes samples"| node_landmark_data
node_kaggle_preparer -->|"writes landmarks"| node_landmark_data
node_landmark_data -.->|"provides samples"| node_transformer_training
node_landmark_data -.->|"provides samples"| node_standard_training
node_transformer_training -->|"trains architecture"| node_landmark_model
node_transformer_training -->|"saves checkpoint"| node_model_artifacts
node_transformer_training -->|"writes metrics"| node_evaluation
node_standard_training -->|"saves classifier"| node_model_artifacts
node_standard_training -->|"writes metrics"| node_evaluation

click node_application "https://github.com/lenguyen1726/khdl/blob/main/Application.py"
click node_landmark_model "https://github.com/lenguyen1726/khdl/blob/main/landmark_transformer_model.py"
click node_custom_collector "https://github.com/lenguyen1726/khdl/blob/main/collect_custom_landmarks_auto_safe.py"
click node_kaggle_preparer "https://github.com/lenguyen1726/khdl/blob/main/prepare_kaggle_landmarks_standard.py"
click node_transformer_training "https://github.com/lenguyen1726/khdl/blob/main/train_landmark_transformer.py"
click node_standard_training "https://github.com/lenguyen1726/khdl/blob/main/train_landmark_model_standard.py"
click node_model_testing "https://github.com/lenguyen1726/khdl/blob/main/test_kaggle_model.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_application,node_landmark_model,node_user toneBlue
class node_custom_collector,node_kaggle_preparer,node_landmark_data toneAmber
class node_transformer_training,node_standard_training,node_model_artifacts,node_evaluation,node_model_testing toneMint
class node_webcam toneIndigo
```

## Components

### Live sign-to-text

- [Desktop application](https://github.com/lenguyen1726/khdl/blob/main/Application.py): `Application.py`
- [Landmark Transformer](https://github.com/lenguyen1726/khdl/blob/main/landmark_transformer_model.py): `landmark_transformer_model.py`

### Landmark data

- [Custom sample collector](https://github.com/lenguyen1726/khdl/blob/main/collect_custom_landmarks_auto_safe.py): `collect_custom_landmarks_auto_safe.py`
- [Kaggle landmark preparation](https://github.com/lenguyen1726/khdl/blob/main/prepare_kaggle_landmarks_standard.py): `prepare_kaggle_landmarks_standard.py`
- **Landmark datasets**

### Model training

- [Transformer training](https://github.com/lenguyen1726/khdl/blob/main/train_landmark_transformer.py): `train_landmark_transformer.py`
- [Standard model training](https://github.com/lenguyen1726/khdl/blob/main/train_landmark_model_standard.py): `train_landmark_model_standard.py`
- **Trained model artifacts**
- **Evaluation outputs**
- [Kaggle model test](https://github.com/lenguyen1726/khdl/blob/main/test_kaggle_model.py): `test_kaggle_model.py`

### Other components

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

## Connections

- Webcam → Desktop application: supplies frames (evidence: `Application.py`)
- Desktop application → Landmark Transformer: runs inference (evidence: `Application.py`)
- Desktop application → App user: shows text
- App user → Desktop application: controls text
- Custom sample collector → Landmark datasets: writes samples (evidence: `collect_custom_landmarks_auto_safe.py`)
- Kaggle landmark preparation → Landmark datasets: writes landmarks (evidence: `prepare_kaggle_landmarks_standard.py`)
- Landmark datasets → Transformer training: provides samples
- Landmark datasets → Standard model training: provides samples
- Transformer training → Landmark Transformer: trains architecture (evidence: `train_landmark_transformer.py`)
- Transformer training → Trained model artifacts: saves checkpoint (evidence: `train_landmark_transformer.py`)
- Transformer training → Evaluation outputs: writes metrics (evidence: `train_landmark_transformer.py`)
- Standard model training → Trained model artifacts: saves classifier (evidence: `train_landmark_model_standard.py`)
- Standard model training → Evaluation outputs: writes metrics (evidence: `train_landmark_model_standard.py`)
