# openvinotoolkit/training_extensions architecture

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

- Interactive diagram: https://gitdiagram.com/openvinotoolkit/training_extensions
- Repository: https://github.com/openvinotoolkit/training_extensions

## Overview

##### Project Type and Purpose
- This is a low-code computer vision transfer learning framework built with deep learning technologies.
- Its goal is to enable users (even with low expertise in deep learning) to train, infer, optimize, and deploy various computer vision models (classification, detection, segmentation, etc.) via both an API and a CLI.
- The project builds on PyTorch and OpenVINO™ and provides “recipes” (model templates) and auto-configuration to streamline training.

##### File Structure
- Notice major directories such as “src” (with subdirectories for algorithms, core, cli, data, engine, recipe, etc.). Each subdirectory corresponds to key components:
– The “otx” package in src is the heart of the system. It includes submodules that handle algorithms (for classification, detection, etc.), training recipes, data processing, CLI tools, and engine management.
– “docs” and “for_developers” provide extensive documentation, guides, and design references.
– “tests” are organized thoroughly into unit, integration, regression, and performance tests for all components.
- There are also CI/CD configuration folders (e.g., .ci and .github) and Docker-related files (in both .ci/docker and docker directories), which indicate the project’s continuous integration/deployment strategy.
- Build and packaging files (pyproject.toml, setup-like files, MANIFEST.in, etc.) confirm that the project is structured for distribution and developer contributions.

##### Elements
– "CLI/API Interface"
– "Training Engine & Auto-Configuration"
– "Data Ingestion & Preprocessing"
– "Model Export & Inference"
– "Core Utilities & Configuration Management"
– "CI/CD Pipelines & Deployment (Docker, GitHub Actions)"
– From CLI/API to the Training Engine
– From Data modules to the Training Engine
– From the Engine to different Algorithm Modules
– Then to Export functionalities and outwards towards deployment
- Optionally, include annotations explaining key processes (like auto-configuration, distributed training, and mixed-precision training).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI["CLI/API Interface"]:::ui
    end

    subgraph "Training Pipeline"
        DI["Data Ingestion & Preprocessing"]:::data
        ENG["Engine"]:::engine
        AC["Auto-Configurator"]:::engine
        ALG["Algorithm Modules"]:::algo
        CM["Configuration Management"]:::core
        CU["Core Utilities"]:::core
        EXP["Model Exporter & Inference"]:::export
    end

    subgraph "CI/CD & Deployment"
        GH["GitHub Actions"]:::cicd
        DOCK["Docker Deployment"]:::cicd
    end

    UI -->|"triggers"| ENG
    DI -->|"suppliesData"| ENG
    ENG -->|"autoConfigures"| AC
    ENG -->|"selectsAlgorithm"| ALG
    ENG -->|"configRequest"| CM
    ENG -->|"utilizes"| CU
    ENG -->|"outputsTrainedModel"| EXP
    ALG -->|"sendsModel"| EXP
    EXP -->|"deploysVia"| GH
    EXP -->|"deploysVia"| DOCK

    click UI "https://github.com/openvinotoolkit/training_extensions/blob/develop/src/otx/cli/cli.py"
    click ENG "https://github.com/openvinotoolkit/training_extensions/blob/develop/src/otx/engine/engine.py"
    click AC "https://github.com/openvinotoolkit/training_extensions/blob/develop/src/otx/engine/utils/auto_configurator.py"
    click DI "https://github.com/openvinotoolkit/training_extensions/tree/develop/src/otx/core/data"
    click ALG "https://github.com/openvinotoolkit/training_extensions/tree/develop/src/otx/algo"
    click EXP "https://github.com/openvinotoolkit/training_extensions/tree/develop/src/otx/core/exporter"
    click CM "https://github.com/openvinotoolkit/training_extensions/tree/develop/src/otx/core/config"
    click CU "https://github.com/openvinotoolkit/training_extensions/tree/develop/src/otx/core/utils"
    click GH "https://github.com/openvinotoolkit/training_extensions/blob/develop/.github"
    click DOCK "https://github.com/openvinotoolkit/training_extensions/tree/develop/.ci/docker"

    classDef ui fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef engine fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef algo fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef data fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef export fill:#d1ecf1,stroke:#333,stroke-width:2px;
    classDef core fill:#fdfd96,stroke:#333,stroke-width:2px;
    classDef cicd fill:#e2e3e5,stroke:#333,stroke-width:2px;
```
