# tkag0001/air_control_mouse architecture

> Architecture diagram of the GitHub repository tkag0001/air_control_mouse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tkag0001/air_control_mouse
- Repository: https://github.com/tkag0001/air_control_mouse

## Overview

##### Project Type and Purpose
- The project is a gesture-based control application, where hand gestures (captured via a webcam) are analyzed to simulate mouse actions.
- The README indicates the setup, dependencies, and how to run the main application (using app.py).

##### File Structure Analysis
- Top-Level Files:
- LICENSE, README.md – Project documentation.
- app.py – Serves as the main entry point for running the application.
- requirements.txt – Lists Python dependencies.
- Directories:
- images – Contains visual aids/instructions that illustrate usage; these can also serve as a quick guide to the different actions.
- model – Houses the machine learning component.
◦ model/__init__.py ensures the module is recognized.
◦ Within the subdirectory “keypoint_classifier”, there are:
▪ keypoint_classifier.py – The core code for interpreting hand keypoints.
▪ CSV, HDF5, and TFLite files – Pre-trained model weights and configurations, indicating support for different runtime formats (e.g., TensorFlow Lite for potentially lighter or mobile deployments).

##### Architectural Components
a. Input/Acquisition Component:
- Image capture mechanism (likely integrated within app.py) that acquires video frames from the user’s webcam.
b. Preprocessing/Feature Extraction:
- Processing of the captured frames to extract hand keypoints. Even if not explicitly detailed in the file tree, this is implied by the existence of a keypoint classifier.
c. Core Classification Component:
- Three versions of model weights (CSV, HDF5, TFLite) to indicate the flexibility or various deployment options.
d. Control/Output Component:
- Module or logic within app.py that maps the classification outcomes into concrete mouse actions (e.g., left click, right click, scroll up/down, normal movement).
e. External Dependencies and Interactions:
- Use of external libraries from requirements.txt, such as those for image processing, machine learning (e.g., TensorFlow or similar), and interacting with the operating system’s mouse control APIs.

##### Architectural Patterns/Design Principles
- The system employs a modular design, separating:
- The UI/input layer (app.py handling camera input and interfacing with the OS)
- The ML model layer (inside the model directory) for classification.
- This separation facilitates potential re-use or replacement of the classification component along with simple maintenance or upgrades to the gesture model.
- That there is a clear division of responsibilities between capturing data, processing it, and translating the output into mouse events.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Process"
        A["Webcam Capture (app.py)"]:::input
        B["Preprocessing & Feature Extraction"]:::process
        C["Keypoint Classifier Module"]:::classifier
        E["Mouse Action Mapping (app.py)"]:::output
        F["OS Mouse API"]:::external
    end
    D["Pre-trained Model Assets"]:::assets
    G["External Dependencies"]:::external
    H["Documentation & Visual Guides"]:::doc

    A -->|"captures"| B
    B -->|"processes"| C
    C -->|"classifies"| E
    E -->|"executes"| F
    D -->|"loadedBy"| C
    G -->|"dependencyFor"| A
    G -->|"dependencyFor"| E

    click A "https://github.com/tkag0001/air_control_mouse/blob/main/app.py"
    click E "https://github.com/tkag0001/air_control_mouse/blob/main/app.py"
    click C "https://github.com/tkag0001/air_control_mouse/blob/main/model/keypoint_classifier/keypoint_classifier.py"
    click D "https://github.com/tkag0001/air_control_mouse/tree/main/model/keypoint_classifier/"
    click G "https://github.com/tkag0001/air_control_mouse/blob/main/requirements.txt"
    click H "https://github.com/tkag0001/air_control_mouse/tree/main/images"

    classDef input fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef process fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef classifier fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef output fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef assets fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef doc fill:#98FB98,stroke:#333,stroke-width:2px;
```
