# computervisioneng/sign-language-detector-python architecture

> Architecture diagram of the GitHub repository computervisioneng/sign-language-detector-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/computervisioneng/sign-language-detector-python
- Repository: https://github.com/computervisioneng/sign-language-detector-python

## Overview

##### Main Components
- Data Collection Module:
- Scripts: collect_imgs.py and create_dataset.py
- Role: These scripts are responsible for capturing images (via OpenCV) and organizing them into a dataset, possibly performing pre-processing steps before training.
- Model Training Component:
- Script: train_classifier.py
- Role: Uses the dataset to train a classifier model for sign language detection.
- Inference Engine:
- Script: inference_classifier.py
- Role: Loads the trained model to make predictions from new images or video feeds.
- Data Repository:
- Directory: data (with its .gitignore file)
- Role: Stores the image samples and possibly intermediate results required both for training and inference.
- External Dependencies and Tools:
- Frameworks/libraries: OpenCV, Mediapipe (as highlighted in the README), and other Python dependencies listed in requirements.txt.

##### Relationships and Data Flow
- The user initiates data capture by running collect_imgs.py, which integrates with OpenCV (for image acquisition) and potentially uses Mediapipe to detect and crop hand gestures.
- The output from the data collection might then be processed or reorganized by create_dataset.py, preparing the dataset for training.
- The prepared dataset is fed into train_classifier.py where the classifier is trained.
- Once the model is trained, inference_classifier.py uses the model to perform sign language detection on live inputs or stored images.
- The data directory serves as the central repository where all images and related artifacts are stored.

##### Architectural Patterns and Design Principles
- Data Flow Separation: Illustrate a clear sequence starting from data acquisition, through preprocessing, training, and finally inference.
- Reusability: Since the components (data collection, training, and inference) are decoupled, they can be extended or replaced as needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    ED("requirements.txt"):::dependency
    EX("OpenCV & Mediapipe"):::dependency

    %% Data Collection Layer
    subgraph "Data Collection"
        DC("collect_imgs.py"):::script
        DR("data/"):::storage
    end

    %% Dataset Processing Layer
    subgraph "Dataset Processing"
        DS("create_dataset.py"):::script
    end

    %% Model Training Layer
    subgraph "Model Training"
        MT("train_classifier.py"):::script
    end

    %% Inference Engine Layer
    subgraph "Inference Engine"
        INF("inference_classifier.py"):::script
    end

    %% Data Flow Connections
    EX -->|"uses"| DC
    DC -->|"saves images"| DR
    DR -->|"prepares dataset"| DS
    DS -->|"feeds data"| MT
    MT -->|"produces model"| INF

    %% External Dependencies for Training and Inference
    ED -->|"provides libraries"| MT
    ED -->|"provides libraries"| INF

    %% Click Events
    click DC "https://github.com/computervisioneng/sign-language-detector-python/blob/master/collect_imgs.py"
    click DS "https://github.com/computervisioneng/sign-language-detector-python/blob/master/create_dataset.py"
    click MT "https://github.com/computervisioneng/sign-language-detector-python/blob/master/train_classifier.py"
    click INF "https://github.com/computervisioneng/sign-language-detector-python/blob/master/inference_classifier.py"
    click DR "https://github.com/computervisioneng/sign-language-detector-python/tree/master/data/"
    click ED "https://github.com/computervisioneng/sign-language-detector-python/blob/master/requirements.txt"

    %% Styles
    classDef script fill:#f9c,stroke:#333,stroke-width:2px;
    classDef storage fill:#bbf,stroke:#333,stroke-width:2px;
    classDef dependency fill:#dfd,stroke:#333,stroke-width:2px;
```
