# kapilw25/evaluation_generated_images architecture

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

- Interactive diagram: https://gitdiagram.com/kapilw25/evaluation_generated_images
- Repository: https://github.com/kapilw25/evaluation_generated_images

## Overview

##### Main Components
- Data Management & Ingestion:
- The DeepFashion folder holds raw input data (images, captions, labels, keypoints) used for training and evaluation.
- Metadata Preprocessing:
- The new component (metadata_preprocessing.py) processes structured input files (CSV, JSON) from the dataset. It likely cleans, normalizes, and transforms the raw metadata, and then outputs a processed file (for example, processed_metadata.csv) typically stored in the results or a similar output folder.
- Model Training/Generation Pipeline:
- Scripts such as text2image_generation.py are responsible for generating images from text.
- Evaluation Pipeline:
- Files like evaluation_metrics.py and evaluation_pipeline.py compute performance metrics (e.g., FID, LPIPS, Recall@3, MRR) using results stored in the mlruns and results directories.
- Experiment Tracking:
- The mlruns folder shows structured experiment logs managed by MLflow. It stores metrics, parameters, and metadata for different runs.
- Image Generation Artifacts:
- The image_generated directory contains outputs from various image generation models (CogView, Context_LoRA, Flux, etc.) along with their metadata.
- Visualization/Demo Interface:
- The visualization_app.py (and associated demo assets in README_files) is used to present the results and system outputs, providing a user interface or dashboard.
- Notebook for Interactivity:
- test.ipynb can serve to experiment with or demonstrate parts of the system interactively.

##### Relationships and Data Flow
- The raw data in the DeepFashion folder feeds into the metadata preprocessing module (metadata_preprocessing.py), which outputs a cleaned metadata file.
- This processed metadata, along with raw images and captions, is then used by the text-to-image generation script and the overall training pipeline.
- Generated images are stored in the image_generated folder with accompanying metadata that can be evaluated.
- The evaluation pipeline takes artifacts from image generation and computes various evaluation metrics, logging them through MLflow in the mlruns folder.
- Finally, the visualization_app.py consumes the processed images, evaluation metrics, and possibly experiment metadata to render a demo dashboard for users.

##### Architectural Patterns and Design Principles
- Modular Pipelines: Each component (data preprocessing, model generation, evaluation, and visualization) is implemented as a standalone module, making it easier to manage and extend.
- Experiment Tracking: Leveraging MLflow (via the mlruns directory) helps in maintaining reproducibility and performance comparison across multiple runs.
- Separation of Concerns: Data ingestion, processing, evaluation, and presentation are well isolated, which improves maintainability.

##### Relevant Technologies, Frameworks, and Files
- Python Scripts: All the key functionalities (generation, evaluation, preprocessing) are available as Python scripts.
- MLflow: For experiment tracking and logging metrics.
- CSV/JSON Files: Used for storing input/output metadata, indicating a reliance on commonly used data formats.
- Visualization: The visualization_app.py and demo images included in README_files provide a front-end view of the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Layer"
        DataInput["DeepFashion Dataset (Raw Data)"]
    end

    subgraph "Processing Layer"
        MetadataPre["Metadata Preprocessing (metadata_preprocessing.py)"]
        ImgGen["Image Generation Pipeline (text2image_generation.py)"]
    end

    subgraph "Artifacts Layer"
        ImgArtifacts["Image Generation Artifacts (image_generated/)"]
    end

    subgraph "Evaluation Layer"
        EvalPipeline["Evaluation Pipeline (evaluation_pipeline.py)"]
        EvalMetrics["Evaluation Metrics (evaluation_metrics.py)"]
        MLflow["MLflow Experiment Tracking (mlruns/)"]
    end

    subgraph "Presentation Layer"
        Visualization["Visualization/Demo Interface (visualization_app.py)"]
        Notebook["Interactive Notebook (test.ipynb)"]
    end

    DataInput -->|"feeds_into"| MetadataPre
    MetadataPre -->|"outputs_processed_metadata_to"| ImgGen
    ImgGen -->|"generates_images_to"| ImgArtifacts
    ImgArtifacts -->|"evaluated_by"| EvalPipeline
    ImgArtifacts -->|"evaluated_by"| EvalMetrics
    EvalPipeline -->|"logs_to"| MLflow
    EvalMetrics -->|"logs_to"| MLflow
    MLflow -->|"metrics_feed"| Visualization
    ImgArtifacts -->|"directly_informs"| Visualization
    Notebook -->|"interacts_with"| Visualization

    class DataInput data
    class MetadataPre,ImgGen processing
    class ImgArtifacts artifacts
    class EvalPipeline,EvalMetrics,MLflow evaluation
    class Visualization,Notebook presentation

    classDef data fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef processing fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef artifacts fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef evaluation fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef presentation fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    click DataInput "https://github.com/kapilw25/evaluation_generated_images/tree/main/DeepFashion/"
    click MetadataPre "https://github.com/kapilw25/evaluation_generated_images/blob/main/metadata_preprocessing.py"
    click ImgGen "https://github.com/kapilw25/evaluation_generated_images/blob/main/text2image_generation.py"
    click ImgArtifacts "https://github.com/kapilw25/evaluation_generated_images/tree/main/image_generated/"
    click EvalPipeline "https://github.com/kapilw25/evaluation_generated_images/blob/main/evaluation_pipeline.py"
    click EvalMetrics "https://github.com/kapilw25/evaluation_generated_images/blob/main/evaluation_metrics.py"
    click MLflow "https://github.com/kapilw25/evaluation_generated_images/tree/main/mlruns/"
    click Visualization "https://github.com/kapilw25/evaluation_generated_images/blob/main/visualization_app.py"
    click Notebook "https://github.com/kapilw25/evaluation_generated_images/blob/main/test.ipynb"
```
