# bmw-innovationlab/bmw-tensorflow-training-gui architecture

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

- Interactive diagram: https://gitdiagram.com/bmw-innovationlab/bmw-tensorflow-training-gui
- Repository: https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui

## Overview

##### Main Components
- Frontend (GUI):
- Located in the “gui” directory, built with Angular.
- Responsible for displaying the training dashboard, job configuration screens, logs, TensorBoard visualization, and providing a Swagger-based inference API testing interface.
- Training API:
- Found in the “training_api” folder.
- Handles configuration, data preparation, hyperparameter management, training orchestration, export of models (including checkpoints, inference graphs, TensorBoard export), and job life-cycle management.
- Inference API:
- Located in the “inference_api” folder.
- Provides the built-in REST API for testing and inference with trained models.
- Docker SDK API:
- In the “docker_sdk_api” folder.
- Manages container orchestration tasks such as starting/stopping containers, checking container statuses, and interacting with Docker (e.g., setting up ports, handling proxy configurations). It likely acts as an intermediary to the Docker engine.
- Shared Infrastructure & Datasets:
- Directories like “datasets”, “checkpoints”, and “tensorboards” serve as shared storage for input image/label data, training checkpoints, and TensorBoard logs.
- Configuration & Environment Components:
- Various JSON files (such as networks.json, paths.json, and objectclasses.json) and scripts (like setup_solution_parameters.sh, adjust_basedir_path.py, and proxy configuration utilities) manage system parameters, pre-trained weights selections, and deployment-level settings.
- Docker & Deployment:
- Dockerfiles (in training_api, inference_api, docker_sdk_api, and GUI directories) and multiple Docker Compose YAML files (“build_cpu.yml”, “build_gpu.yml”, “run_cpu.yml”, “run_gpu.yml”) illustrate a clear containerized microservice deployment pattern.

##### Out the Relationships and Data Flow
- The shared volumes or storage areas (“datasets”, “checkpoints”, “tensorboards”) are accessed by both training and inference processes. Represent these as a central resource that the Training API and Inference API both read/write.

##### Architectural Patterns and Design Principles
- The project has split responsibilities across microservices where each service (GUI, Training API, Inference API, Docker SDK API) follows a separation-of-concerns approach.
- Many folders follow the MVC or Domain Driven Design patterns, with “controllers”, “domain”, and “application” layers separating logic.
- Docker is used as the orchestration and deployment runtime, and Docker Compose files illustrate multi-container setups, enforcing containerization as a core design principle.

##### Technology/Framework Details
- Frontend: Angular framework
- Backend / API Services: Python-based REST APIs (likely using frameworks such as FastAPI or Flask integrated with uvicorn, as indicated by the uvicorn port configuration in docker_sdk_api/Dockerfile).
- Deep Learning: TensorFlow 2.5.0 used for training from pre-trained weights from the TensorFlow model zoo.
- Containerization: Docker, Docker Compose, NVIDIA Docker for GPU support.
- Data Format/Storage: JSON, XML (Pascal VOC) formats for labels; standard file/directory structures for datasets and checkpoint storage.

##### Putting It All Together
[User] → [Angular GUI]
↙                ↘
[Training API]       [Inference API]
↘                ↙
[Docker SDK API]
- Next to these blocks, indicate shared resource blocks for “Datasets”, “Checkpoints”, and “TensorBoard Logs” along with an external dependency block for “Pre-trained Weights Source (TF Model Zoo)”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Title Block
    TITLE["TensorFlow 2 Object Detection Training & Inference Platform"]:::title
    TITLE --- USER

    %% User Interaction
    subgraph "User Interaction"
        USER["User"]:::user
    end

    %% Frontend Layer
    subgraph "Frontend"
        GUI["Angular GUI"]:::service
    end

    %% Backend Services
    subgraph "Backend Services"
        TAPI["Training API"]:::service
        IAPI["Inference API"]:::service
        DSDK["Docker SDK API"]:::service
    end

    %% Shared Infrastructure
    subgraph "Shared Infrastructure"
        DATA["Datasets"]:::storage
        CKPT["Checkpoints"]:::storage
        TB["TensorBoard Logs"]:::storage
    end

    %% External Dependencies
    subgraph "External Dependencies"
        TF["TF Model Zoo"]:::external
    end

    %% Configuration & Environment Components
    subgraph "Configuration & Environment"
        JSON1["Networks Config"]:::config
        JSON2["Paths Config"]:::config
        JSON3["ObjectClasses Config"]:::config
        ADJUST["adjust_basedir_path.py"]:::config
        SETUP["setup_solution_parameters.sh"]:::config
        PROXY["proxy.json"]:::config
        SET_PROXY["set_proxy_args.py"]:::config
    end

    %% Deployment & Docker
    subgraph "Deployment & Docker"
        GUI_DOCK["GUI Dockerfile"]:::docker
        TAPI_CPU["TAPI CPU Dockerfile"]:::docker
        TAPI_GPU["TAPI GPU Dockerfile"]:::docker
        IAPI_DOCK["IAPI Dockerfile"]:::docker
        IAPI_DOCK_GPU["IAPI GPU Dockerfile"]:::docker
        DSDK_DOCK["Docker SDK Dockerfile"]:::docker
        COMPOSE_BUILD_CPU["build_cpu.yml"]:::docker
        COMPOSE_BUILD_GPU["build_gpu.yml"]:::docker
        COMPOSE_RUN_CPU["run_cpu.yml"]:::docker
        COMPOSE_RUN_GPU["run_gpu.yml"]:::docker
    end

    %% Connections between layers
    USER -->|"uses"| GUI
    GUI -->|"calls"| TAPI
    GUI -->|"calls"| IAPI
    TAPI -->|"orchestrates"| DSDK
    TAPI -->|"accesses"| DATA
    TAPI -->|"accesses"| CKPT
    TAPI -->|"accesses"| TB
    IAPI -->|"accesses"| DATA
    IAPI -->|"accesses"| CKPT
    IAPI -->|"accesses"| TB
    TAPI -->|"downloads"| TF

    %% Configuration influence arrows
    JSON1 --- TAPI
    JSON2 --- TAPI
    JSON3 --- IAPI
    ADJUST --- TAPI
    SETUP --- TAPI
    PROXY --- DSDK
    SET_PROXY --- DSDK

    %% Deployment associations (indicating containerization of services)
    GUI_DOCK --- GUI
    TAPI_CPU --- TAPI
    TAPI_GPU --- TAPI
    IAPI_DOCK --- IAPI
    IAPI_DOCK_GPU --- IAPI
    DSDK_DOCK --- DSDK
    COMPOSE_BUILD_CPU --- GUI
    COMPOSE_BUILD_CPU --- TAPI
    COMPOSE_BUILD_CPU --- IAPI
    COMPOSE_BUILD_CPU --- DSDK
    COMPOSE_BUILD_GPU --- GUI
    COMPOSE_BUILD_GPU --- TAPI
    COMPOSE_BUILD_GPU --- IAPI
    COMPOSE_BUILD_GPU --- DSDK
    COMPOSE_RUN_CPU --- GUI
    COMPOSE_RUN_CPU --- TAPI
    COMPOSE_RUN_CPU --- IAPI
    COMPOSE_RUN_CPU --- DSDK
    COMPOSE_RUN_GPU --- GUI
    COMPOSE_RUN_GPU --- TAPI
    COMPOSE_RUN_GPU --- IAPI
    COMPOSE_RUN_GPU --- DSDK

    %% Styling Classes
    classDef service fill:#f9e79f,stroke:#b7950b,stroke-width:2px;
    classDef storage fill:#abebc6,stroke:#1e8449,stroke-width:2px;
    classDef external fill:#d2b4de,stroke:#7d3c98,stroke-width:2px;
    classDef config fill:#f5b7b1,stroke:#943126,stroke-width:2px;
    classDef docker fill:#aed6f1,stroke:#1f618d,stroke-width:2px;
    classDef user fill:#fad7a0,stroke:#d35400,stroke-width:2px;
    classDef title fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;

    %% Click Event Mappings
    click GUI "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/gui/"
    click TAPI "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/training_api/"
    click IAPI "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/inference_api/"
    click DSDK "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/docker_sdk_api/"
    click DATA "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/datasets/"
    click CKPT "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/checkpoints/"
    click TB "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/tensorboards/"
    click JSON1 "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/training_api/assets/networks.json"
    click JSON2 "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/training_api/assets/paths.json"
    click JSON3 "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/datasets/sample_dataset/objectclasses.json"
    click ADJUST "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/adjust_basedir_path.py"
    click SETUP "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/setup_solution_parameters.sh"
    click PROXY "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/proxy.json"
    click SET_PROXY "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/set_proxy_args.py"
    click GUI_DOCK "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/gui/Dockerfile"
    click TAPI_CPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/training_api/docker/CPU/Dockerfile"
    click TAPI_GPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/training_api/docker/GPU/Dockerfile"
    click IAPI_DOCK "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/inference_api/docker/dockerfile"
    click IAPI_DOCK_GPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/inference_api/docker/dockerfile-gpu"
    click DSDK_DOCK "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/tree/master/docker_sdk_api/docker/Dockerfile"
    click COMPOSE_BUILD_CPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/build_cpu.yml"
    click COMPOSE_BUILD_GPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/build_gpu.yml"
    click COMPOSE_RUN_CPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/run_cpu.yml"
    click COMPOSE_RUN_GPU "https://github.com/bmw-innovationlab/bmw-tensorflow-training-gui/blob/master/run_gpu.yml"
```
