# yuliangxiu/icon architecture

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

- Interactive diagram: https://gitdiagram.com/yuliangxiu/icon
- Repository: https://github.com/yuliangxiu/icon

## Overview

##### Main Components
- Inference & Training Modules: Note that under the “apps” folder, there are separate scripts for inference (infer.py) and training variants (train.py, train-normal.py, train-normal training scripts, etc.). These serve as the entry points for running and training the models.
- Core Deep Learning Models: Multiple directories (e.g., “lib/net”, “lib/hybrik”, “lib/pare”, “lib/pixielib”, “lib/pymaf”) indicate the presence of diverse network architectures and model implementations. These submodules implement backbone networks, layers (including ResNet, HRNet, attention modules), and head modules to predict normals, 3D body meshes, and cloth details.
- Rendering & Visualization Modules: The “lib/renderer” module, with OpenGL based scripts and rendering utilities, handles the generation of output meshes, normal maps, and videos, thus closing the loop with visualization.
- Pre-/Post-Processing & Utility Scripts: Additional scripts in “scripts” and “colab.sh” or “fetch_data.sh,” plus the “assets” folder for assets like teaser GIFs, signify stages for data acquisition, testing, and demonstration.

##### Relationships and Interactions
- The primary workflow begins with input image data that is preprocessed by the Dataset modules. Configuration files dictate which model variant and training settings to use.
- The training or inference “apps” module calls into the deep learning libraries (e.g., “lib/net”, “lib/hybrik”, “lib/pare”, “lib/pymaf”) to process data. These modules interact via clearly defined APIs, fed by the parameters specified in the configs.
- During inference, the predicted outputs (e.g., normal maps, 3D meshes, segmented images) are passed to the Renderer module (located in “lib/renderer”) which prepares the final visuals and video outputs.
- Different components (like garment extraction, SMPL body fitting, pose refinement, etc.) integrate with each other, sometimes invoking external systems (e.g., interfacing with PIFuHD or KeypointNeRF ideas as noted in the README).

##### Architectural Patterns & Design Principles
- Modularity: The project is organized into focused modules (apps, configs, lib, docs, etc.) allowing independent development of data processing, network modeling, and rendering.
- Config-Driven Execution: Use of YAML config files for switching between various model types and training/evaluation setups.
- Multi-Tool Integration: It unifies several sub-systems (different HPS methods, rendering engines, and dataset handling modules) under one architecture.
- Reusability & Extensibility: The use of submodules (in lib/) and integration with external projects illustrates an architecture designed for plug-and-play extensibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data & Preprocessing Layer
    subgraph "Data & Preprocessing"
        DS["Dataset Modules"]:::data
    end

    %% Configuration Management Layer
    subgraph "Configuration Management"
        CFG["Configs"]:::config
    end

    %% Application Entry Points Layer
    subgraph "Application Entry Points"
        IN["Inference App"]:::app
        T1["Training App"]:::app
        T2["Training Normal App"]:::app
    end

    %% External Tools Layer
    subgraph "External Tools"
        EX["External Pose & Shape Estimators"]:::app
    end

    %% Core Deep Learning Models Layer
    subgraph "Core Deep Learning Models"
        CORE["Deep Networks"]:::core
    end

    %% Rendering & Visualization Layer
    subgraph "Rendering & Visualization"
        REN["Renderer Module"]:::render
    end

    %% Utility & Pre/Post Processing Layer
    subgraph "Utility & Pre/Post Processing"
        UT["Utility Scripts"]:::util
    end

    %% Connections

    %% Data & Preprocessing flows
    DS -->|"preprocessed"| IN
    DS -->|"preprocessed"| T1
    DS -->|"preprocessed"| T2

    %% Configuration flows
    CFG -->|"readsConfig"| IN
    CFG -->|"readsConfig"| T1
    CFG -->|"readsConfig"| T2

    %% Application Entry Points to Core Models
    IN -->|"modelProcessing"| CORE
    T1 -->|"modelProcessing"| CORE
    T2 -->|"modelProcessing"| CORE

    %% External Tools integration with Core Models
    EX -->|"integrate"| CORE

    %% Core Models to Rendering
    CORE -->|"generateOutput"| REN

    %% Utility connections
    UT -->|"fetchData"| DS
    UT -->|"postProcess"| REN

    %% Click Events
    click IN "https://github.com/yuliangxiu/icon/blob/master/apps/infer.py"
    click T1 "https://github.com/yuliangxiu/icon/blob/master/apps/train.py"
    click T2 "https://github.com/yuliangxiu/icon/blob/master/apps/train-normal.py"
    click CFG "https://github.com/yuliangxiu/icon/tree/master/configs/"
    click DS "https://github.com/yuliangxiu/icon/tree/master/lib/dataset/"
    click CORE "https://github.com/yuliangxiu/icon/tree/master/lib/net/"
    click REN "https://github.com/yuliangxiu/icon/tree/master/lib/renderer/"
    click UT "https://github.com/yuliangxiu/icon/tree/master/scripts/"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef config fill:#E0FFFF,stroke:#000,stroke-width:2px;
    classDef app fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef core fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef render fill:#FFD580,stroke:#000,stroke-width:2px;
    classDef util fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
