# tianhe2005/-interactionsystem architecture

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

- Interactive diagram: https://gitdiagram.com/tianhe2005/-interactionsystem
- Repository: https://github.com/tianhe2005/-interactionsystem

## Overview

##### Main Components
- Frontend (GUI): The “GUI” directory contains the user interface elements (both Python and UI file formats). These include login and main interface components.
- Core Application/Orchestration: Files like main.py, detect.py, and thread1.py act as controllers or orchestrators coordinating interaction and detection flow.
- Service Layer: The “service” folder provides modular services such as video control, game service, and saving actions. Each service (e.g., ControlVideoPlay, PlayService, PlayShootingGameService, SaveActionSave) likely encapsulates business logic and supports interaction with the core engine.
- Domain/Entity Layer: The “entity” folder encapsulates the core domain objects like VoiceInteraction and modules handling action, angle, judge, position, and software logic. This represents the primary business logic for interaction.
- Detection Models & Utilities: The “models” directory (including yolo.py, experimental, etc.) encapsulates detection logic. The “utils” folder provides supporting functions for data loading, augmentation, metrics, drawing, etc. Additionally, “weights” includes trained model files.
- Build/Deployment: The “build” folder along with configuration files (e.g., requirements.txt, main.spec) indicate how the project is packaged and its dependencies managed.

- Modular Separation: Highlight how the “utils” support various modules and encapsulate common functionalities like callbacks, loss computations, and plotting.
- Dependency Flow: Mark configuration elements such as requirements.txt and build files as external dependencies that influence the complete system deployment.

##### Architectural Patterns & Design Principles
- Layered/Modular Design: Emphasize the clear separation into presentation (GUI), application logic, services, domain models, and utility functions.
- MVC-inspired Segregation: The GUI serves as the “View,” while main orchestrators and entity modules act as the “Controller/Model” layers.
- Service-Oriented Components: The service layer components illustrate modular functions that can be independently updated or replaced.
- Integration of Machine Learning/Detection: The specialized directories (models, weights, utils) point to a dedicated pipeline for target detection.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    A["GUI (User Interface)"]:::frontend

    %% Core Application / Orchestration
    subgraph "Core Application"
        CA1["main.py"]:::core
        CA2["detect.py"]:::core
        CA3["thread1.py"]:::core
    end

    %% Service Layer
    subgraph "Service Layer"
        S1["ControlVideoPlay.py"]:::service
        S2["PlayService.py"]:::service
        S3["PlayShootingGameService.py"]:::service
        S4["SaveActionSave.py"]:::service
    end

    %% Domain / Entity Layer
    subgraph "Domain/Entity Layer"
        D1["VoiceInteraction.py"]:::domain
        D2["action.py"]:::domain
        D3["angle.py"]:::domain
        D4["judge.py"]:::domain
        D5["position.py"]:::domain
        D6["software.py"]:::domain
    end

    %% ML Detection Pipeline
    subgraph "ML Detection Pipeline"
        subgraph "Detection Models"
            MD1["yolo.py"]:::ml
            MD2["common.py"]:::ml
            MD3["experimental"]:::ml
        end
        subgraph "Utilities"
            U1["activations.py"]:::ml
            U2["augmentations.py"]:::ml
        end
        subgraph "Model Weights"
            W1["best.pt"]:::ml
            W2["efficientnet_b3.pt"]:::ml
            W3["yolov5s.pt"]:::ml
        end
    end

    %% Data & Resources
    subgraph "Data & Resources"
        R1["data/"]:::data
        R2["data1/"]:::data
        R3["data2/"]:::data
        R4["icons/"]:::data
        R5["image/"]:::data
        R6["res.qrc"]:::data
    end

    %% Build/Deployment
    subgraph "Build/Deployment"
        BLD1["build/"]:::build
        BLD2["main.spec"]:::build
        BLD3["requirements.txt"]:::build
    end

    %% Connections
    A -->|"UserInput"| CA1
    CA1 -->|"Orchestrates"| CA2
    CA1 -->|"Orchestrates"| CA3

    CA1 -->|"CallsServices"| S1
    CA1 -->|"CallsServices"| S2
    CA1 -->|"CallsServices"| S3
    CA1 -->|"CallsServices"| S4

    CA1 -->|"ExecutesLogic"| D1
    CA1 -->|"ExecutesLogic"| D2
    CA1 -->|"ExecutesLogic"| D3
    CA1 -->|"ExecutesLogic"| D4
    CA1 -->|"ExecutesLogic"| D5
    CA1 -->|"ExecutesLogic"| D6

    CA2 -->|"DetectionProcessing"| MD1

    MD1 -->|"Uses"| U1
    MD1 -->|"Uses"| U2
    MD1 -->|"Loads"| W1
    MD1 -->|"Loads"| W2
    MD1 -->|"Loads"| W3

    R1 ---|"DataInput"| MD1
    R2 ---|"DataInput"| MD1
    R3 ---|"DataInput"| MD1
    R4 ---|"Assets"| A
    R5 ---|"Assets"| A
    R6 ---|"Assets"| A

    BLD1 ---|"DeploymentConfig"| CA1
    BLD2 ---|"DeploymentConfig"| CA1
    BLD3 ---|"DeploymentConfig"| CA1

    %% Click Events for Frontend
    click A "https://github.com/tianhe2005/-interactionsystem/tree/main/GUI/"

    %% Click Events for Core Application
    click CA1 "https://github.com/tianhe2005/-interactionsystem/blob/main/main.py"
    click CA2 "https://github.com/tianhe2005/-interactionsystem/blob/main/detect.py"
    click CA3 "https://github.com/tianhe2005/-interactionsystem/blob/main/thread1.py"

    %% Click Events for Service Layer
    click S1 "https://github.com/tianhe2005/-interactionsystem/blob/main/service/ControlVideoPlay.py"
    click S2 "https://github.com/tianhe2005/-interactionsystem/blob/main/service/PlayService.py"
    click S3 "https://github.com/tianhe2005/-interactionsystem/blob/main/service/PlayShootingGameService.py"
    click S4 "https://github.com/tianhe2005/-interactionsystem/blob/main/service/SaveActionSave.py"

    %% Click Events for Domain/Entity Layer
    click D1 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/VoiceInteraction.py"
    click D2 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/action.py"
    click D3 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/angle.py"
    click D4 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/judge.py"
    click D5 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/position.py"
    click D6 "https://github.com/tianhe2005/-interactionsystem/blob/main/entity/software.py"

    %% Click Events for Detection Models
    click MD1 "https://github.com/tianhe2005/-interactionsystem/blob/main/models/yolo.py"
    click MD2 "https://github.com/tianhe2005/-interactionsystem/blob/main/models/common.py"
    click MD3 "https://github.com/tianhe2005/-interactionsystem/blob/main/models/experimental.py"

    %% Click Events for Utilities
    click U1 "https://github.com/tianhe2005/-interactionsystem/blob/main/utils/activations.py"
    click U2 "https://github.com/tianhe2005/-interactionsystem/blob/main/utils/augmentations.py"

    %% Click Events for Model Weights
    click W1 "https://github.com/tianhe2005/-interactionsystem/blob/main/weights/best.pt"
    click W2 "https://github.com/tianhe2005/-interactionsystem/blob/main/weights/efficientnet_b3.pt"
    click W3 "https://github.com/tianhe2005/-interactionsystem/blob/main/weights/yolov5s.pt"

    %% Click Events for Data & Resources
    click R1 "https://github.com/tianhe2005/-interactionsystem/tree/main/data/"
    click R2 "https://github.com/tianhe2005/-interactionsystem/tree/main/data1/"
    click R3 "https://github.com/tianhe2005/-interactionsystem/tree/main/data2/"
    click R4 "https://github.com/tianhe2005/-interactionsystem/tree/main/icons/"
    click R5 "https://github.com/tianhe2005/-interactionsystem/tree/main/image/"
    click R6 "https://github.com/tianhe2005/-interactionsystem/blob/main/res.qrc"

    %% Click Events for Build/Deployment
    click BLD1 "https://github.com/tianhe2005/-interactionsystem/tree/main/build/"
    click BLD2 "https://github.com/tianhe2005/-interactionsystem/blob/main/main.spec"
    click BLD3 "https://github.com/tianhe2005/-interactionsystem/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef core fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef service fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef domain fill:#F5B7B1,stroke:#943126,stroke-width:2px;
    classDef ml fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef data fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef build fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
