# ksrath0re/clevr_iep_tf architecture

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

- Interactive diagram: https://gitdiagram.com/ksrath0re/clevr_iep_tf
- Repository: https://github.com/ksrath0re/clevr_iep_tf

## Overview

##### Main Components
- Data & Preprocessing:
– Files: iep/data.py, iep/preprocess.py, and scripts/preprocess_questions.py.
– Role: Ingest raw data and perform necessary preprocessing and feature extraction.
- Embedding Module:
– File: iep/embedding.py.
– Role: Handle the transformation of inputs (e.g., text or images) into embedding representations.
- Model Architectures:
– Directory: iep/models.
– Files: module_net.py, seq2seq.py, baselines.py, layers.py, backup* files.
– Role: Define various neural network models/architectures used for processing data.
- Training and Execution Logic:
– Files: scripts/train_model.py, scripts/backup_* and scripts/extract_features.py.
– Role: Scripts to initiate the training process, feature extraction, and model backup.
- Utility and Program Orchestration:
– Files: iep/programs.py and iep/utils.py.
– Role: Support modules to tie components together, manage configurations, and provide helper functions.

##### Relationships and Data Flow
- Move to the Model Layer: Connect the “Embedding” component to “Model Architectures” (which contain different model variants such as Module Net, Seq2Seq, and Baselines).
- Utility & Orchestration: Indicate that “Programs” and “Utils” are support layers interacting with every major module to provide configuration management, logging, and helper functions.

##### Architectural Patterns
- Modularity: The clean separation between data processing, embedding, and modeling reflects a modular design – each component is independently manageable.
- Script-Driven Execution: The training and feature extraction scripts support a “library plus helper scripts” pattern typical of research codebases.
- Flexibility/Extensibility: The existence of “backup” variants of models/scripts indicates experimentation and version management within the architecture.

##### Relevant Technologies
- TensorFlow and TensorFlow-GPU: The project’s runtime and deep learning framework.
- Supporting Python libraries (such as numpy, scipy, and h5py) which bolster data handling and model training.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data & Preprocessing Subgraph
    subgraph "Data & Preprocessing"
        DP1["data.py"]:::data
        DP2["preprocess.py"]:::data
        DP3["preprocess_questions.py"]:::data
    end

    %% Embedding Module Subgraph
    subgraph "Embedding Module"
        EMB["embedding.py"]:::embedding
    end

    %% Model Architectures Subgraph
    subgraph "Model Architectures"
        MN["module_net.py"]:::model
        SS["seq2seq.py"]:::model
        BL["baselines.py"]:::model
        LY["layers.py"]:::model
        BK["backup_module_net.py"]:::model
    end

    %% Training and Execution Logic Subgraph
    subgraph "Training and Execution Logic"
        TM["train_model.py"]:::training
        BM1["backup_25Feb_train_model.py"]:::training
        BM2["backup_old_train_model.py"]:::training
        EF["extract_features.py"]:::training
    end

    %% Utility and Program Orchestration Subgraph
    subgraph "Utility and Program Orchestration"
        PR["programs.py"]:::utility
        UT["utils.py"]:::utility
    end

    %% External Dependency
    EX["TensorFlow Ecosystem"]:::external

    %% Data Flow Connections
    DP1 -->|"raw_data"| EMB
    DP2 -->|"raw_data"| EMB
    DP3 -->|"raw_data"| EMB

    EMB -->|"embeddings"| MN
    EMB -->|"embeddings"| SS
    EMB -->|"embeddings"| BL
    EMB -->|"embeddings"| LY
    EMB -->|"embeddings"| BK

    MN -->|"model_output"| TM
    SS -->|"model_output"| TM
    BL -->|"model_output"| TM
    LY -->|"model_output"| TM
    BK -->|"model_output"| TM

    %% Utility Interactions (dotted connections)
    PR ---|"orchestrates"| DP1
    PR ---|"orchestrates"| EMB
    PR ---|"orchestrates"| MN
    PR ---|"orchestrates"| TM

    %% External Dependency Connections
    EX ---|"framework"| EMB
    EX ---|"framework"| MN
    EX ---|"framework"| TM

    %% Style Definitions
    classDef data fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef embedding fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef model fill:#aed6f1,stroke:#2874a6,stroke-width:2px;
    classDef training fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef utility fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef external fill:#fad7a0,stroke:#e67e22,stroke-width:2px;

    %% Click Events for Data & Preprocessing
    click DP1 "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/data.py"
    click DP2 "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/preprocess.py"
    click DP3 "https://github.com/ksrath0re/clevr_iep_tf/blob/master/scripts/preprocess_questions.py"

    %% Click Event for Embedding Module
    click EMB "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/embedding.py"

    %% Click Events for Model Architectures
    click MN "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/models/module_net.py"
    click SS "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/models/seq2seq.py"
    click BL "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/models/baselines.py"
    click LY "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/models/layers.py"
    click BK "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/models/backup_25Feb_module_net.py"

    %% Click Events for Training and Execution Logic
    click TM "https://github.com/ksrath0re/clevr_iep_tf/blob/master/scripts/train_model.py"
    click BM1 "https://github.com/ksrath0re/clevr_iep_tf/blob/master/scripts/backup_25Feb_train_model.py"
    click BM2 "https://github.com/ksrath0re/clevr_iep_tf/blob/master/scripts/backup_old_train_model.py"
    click EF "https://github.com/ksrath0re/clevr_iep_tf/blob/master/scripts/extract_features.py"

    %% Click Events for Utility and Program Orchestration
    click PR "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/programs.py"
    click UT "https://github.com/ksrath0re/clevr_iep_tf/blob/master/iep/utils.py"
```
