# saaachis/wesee architecture

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

- Interactive diagram: https://gitdiagram.com/saaachis/wesee
- Repository: https://github.com/saaachis/wesee

## Overview

##### Main Components
- User Interface (Frontend): Represented by the “static” folder (CSS, JavaScript files) and “templates” folder (HTML pages for home, about, object/text detection and different modes like capture, live, upload). This is where users interact with the application.
- Application Server (Backend): The “main.py” file is the main entry point which likely sets up the web server (possibly using a framework like Flask). It handles routing and invokes the correct processing modules.
- Text Recognition Module: Similarly, under “text_models” there are files for capturing, live processing, and uploading images for text recognition.
- Deep Learning / Computer Vision Engine: The “yolov5” directory contains the entire YOLOv5 repository – including its models, data configurations, training scripts, and detection scripts – which is used to power object detection capabilities.
- Data & Configuration Files: The “requirements.txt” (and additional configs inside YOLOv5) detail dependencies. Other data files (e.g., “coco.names” inside object_models/data) also contribute to model configuration.
- Additional Documentation: PDF reports and project synopsis provide usage context, though they are not part of the runtime architecture, they support your understanding.

##### Relationships and Interactions
- The Web UI (Frontend) sends image data (from a live camera, captured image, or upload) via HTTP requests—likely through form submissions or AJAX—to the Application Server.
- The Application Server (main.py) routes these requests to the appropriate model-specific module based on the processing (object detection vs. text recognition and the mode selected such as capture, live, upload).
- For object detection, the module under object_models channels the image data into the YOLOv5 inference engine (part of the yolov5 folder), which processes the image and returns detection results.
- For text recognition, the image is processed by the related module under text_models which might be using a separate OCR or deep learning-based text recognition pipeline.
- The processed results, after being augmented with any additional metadata (or audio output capabilities, as mentioned in the README), are sent back to the server which then renders the appropriate HTML view (using templates) to present the results to the user.
- The entire flow is supported by proper dependency management (requirements.txt) and configuration files within YOLOv5.

##### Architectural Patterns and Technologies
- MVC or a similar pattern: The separation between the “templates” (views) and the “main.py” controlling routing/business logic mirrors an MVC approach.
- Modular Design: Separate modules for object detection and text recognition allow for clear boundaries and easier maintenance.
- Microservice-like segregation: While not fully a microservice architecture, the decoupled directories (object_models, text_models, and YOLOv5) indicate a design that separates concerns.
- Integration of external deep learning / computer vision libraries: YOLOv5 is integrated deeply into the project, indicating an emphasis on leveraging community-based computer vision models.

##### Final Reminders
- Clear labels for every component.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        F1("Static Assets"):::frontend
        F2("Templates"):::frontend
    end

    %% API Server
    B("API Server (main.py)"):::backend

    %% Data/Configuration
    F("Dependencies (requirements.txt)"):::config

    %% Object Detection Module
    C("Object Detection Module (object_models)"):::module
    C1("Capture"):::module
    C2("Live"):::module
    C3("Upload"):::module
    CD("coco.names"):::config

    %% Text Recognition Module
    D("Text Recognition Module (text_models)"):::module
    D1("Capture"):::module
    D2("Live"):::module
    D3("Upload"):::module

    %% Deep Learning Engine
    E("Deep Learning Engine (YOLOv5)"):::deep

    %% Connections from Frontend to API Server
    F1 -->|"sends_request"| B
    F2 -->|"sends_request"| B

    %% API Server to Modules
    B -->|"object_detection"| C
    B -->|"text_recognition"| D
    B -->|"load_config"| F

    %% Object Detection Module internal flow
    C -->|"mode"| C1
    C1 ---|"mode"| C2
    C2 ---|"mode"| C3
    C -->|"data"| CD
    C -->|"invoke"| E
    E -->|"return_results"| C
    C -->|"return_results"| B

    %% Text Recognition Module internal flow
    D -->|"mode"| D1
    D1 ---|"mode"| D2
    D2 ---|"mode"| D3
    D -->|"return_results"| B

    %% API Server renders views back to Frontend Templates
    B -->|"render_view"| F2

    %% Click Events
    click F1 "https://github.com/saaachis/wesee/tree/main/static"
    click F2 "https://github.com/saaachis/wesee/tree/main/templates"
    click B "https://github.com/saaachis/wesee/blob/main/main.py"
    click C "https://github.com/saaachis/wesee/tree/main/object_models"
    click C1 "https://github.com/saaachis/wesee/blob/main/object_models/object_detection_capture.py"
    click C2 "https://github.com/saaachis/wesee/blob/main/object_models/object_detection_live.py"
    click C3 "https://github.com/saaachis/wesee/blob/main/object_models/object_detection_upload.py"
    click CD "https://github.com/saaachis/wesee/blob/main/object_models/data/coco.names"
    click D1 "https://github.com/saaachis/wesee/blob/main/text_models/text_recognition_capture.py"
    click D2 "https://github.com/saaachis/wesee/blob/main/text_models/text_recognition_live.py"
    click D3 "https://github.com/saaachis/wesee/blob/main/text_models/text_recognition_upload.py"
    click E "https://github.com/saaachis/wesee/tree/main/yolov5"
    click F "https://github.com/saaachis/wesee/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#FFDDCC,stroke:#BF5700,stroke-width:2px;
    classDef backend fill:#CCFFCC,stroke:#228B22,stroke-width:2px;
    classDef module fill:#CCE5FF,stroke:#0066CC,stroke-width:2px;
    classDef deep fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef config fill:#E6E6FA,stroke:#9370DB,stroke-width:2px;
```
