# levihsu/ootdiffusion architecture

> Architecture diagram of the GitHub repository levihsu/ootdiffusion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/levihsu/ootdiffusion
- Repository: https://github.com/levihsu/ootdiffusion

## Overview

OOTDiffusion is a virtual try-on application: a user supplies a person image and garment, preprocessing derives pose and parsing information, and a half-body or full-body diffusion model produces try-on images. The README also documents a Gradio demo, released checkpoints, and ONNX support for human parsing. The graph reflects documented capabilities and relationships visible in the README or SOURCE INDEX; several subsystem internals were not sampled, so their finer call paths are omitted.

Main entry points: [`run/run_ootd.py`](https://github.com/levihsu/ootdiffusion/blob/main/run/run_ootd.py) (CLI runner), [`run/gradio_ootd.py`](https://github.com/levihsu/ootdiffusion/blob/main/run/gradio_ootd.py) (Gradio demo), [`preprocess/humanparsing/parsing_api.py`](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/parsing_api.py) (Human parsing), [`ootd/pipelines_ootd/pipeline_ootd.py`](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/pipeline_ootd.py) (Diffusion pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entrypoints"]
  node_cli["CLI runner<br/>[run_ootd.py]"]
  node_demo["Gradio demo<br/>[gradio_ootd.py]"]
  node_helpers["Try-on helpers<br/>[utils_ootd.py]"]
end

subgraph group_prep["Image preparation"]
  node_pose["Pose estimation<br/>[run_openpose.py]"]
  node_openpose["OpenPose detector"]
  node_parsing["Human parsing<br/>[parsing_api.py]"]
  node_parse_data["Parsing dataset"]
  node_parse_transforms["Parsing transforms<br/>[transforms.py]"]
  node_parsing_model["Parsing network<br/>[AugmentCE2P.py]"]
end

subgraph group_inference["Try-on inference"]
  node_hd["Half-body model"]
  node_dc["Full-body model"]
end

subgraph group_models["Diffusion components"]
  node_pipeline["Diffusion pipeline<br/>[pipeline_ootd.py]"]
  node_garm_unet["Garment UNet"]
  node_vton_unet["Try-on UNet"]
  node_garm_blocks["Garment blocks"]
  node_vton_blocks["Try-on blocks"]
  node_garm_transformer["Garment transformer"]
  node_vton_transformer["Try-on transformer"]
end

node_user(("User"))
node_result["Try-on images"]

node_user -->|"provides inputs"| node_cli
node_user -->|"provides inputs"| node_demo
node_cli -->|"uses helpers"| node_helpers
node_demo -->|"uses helpers"| node_helpers
node_cli -->|"requests pose"| node_pose
node_cli -->|"requests parsing"| node_parsing
node_demo -->|"requests pose"| node_pose
node_demo -->|"requests parsing"| node_parsing
node_pose -->|"runs detector"| node_openpose
node_parsing -->|"loads dataset"| node_parse_data
node_parsing -->|"uses transforms"| node_parse_transforms
node_parsing -.->|"runs network"| node_parsing_model
node_cli -->|"selects model"| node_hd
node_cli -->|"selects model"| node_dc
node_demo -->|"selects model"| node_hd
node_demo -->|"selects model"| node_dc
node_hd -->|"invokes pipeline"| node_pipeline
node_dc -->|"invokes pipeline"| node_pipeline
node_pipeline -->|"uses garment UNet"| node_garm_unet
node_pipeline -->|"uses try-on UNet"| node_vton_unet
node_garm_unet -->|"dispatches blocks"| node_garm_blocks
node_vton_unet -->|"dispatches blocks"| node_vton_blocks
node_garm_blocks -->|"uses transformer"| node_garm_transformer
node_vton_blocks -->|"uses transformer"| node_vton_transformer
node_pipeline -->|"returns images"| node_result

click node_cli "https://github.com/levihsu/ootdiffusion/blob/main/run/run_ootd.py"
click node_demo "https://github.com/levihsu/ootdiffusion/blob/main/run/gradio_ootd.py"
click node_helpers "https://github.com/levihsu/ootdiffusion/blob/main/run/utils_ootd.py"
click node_pose "https://github.com/levihsu/ootdiffusion/blob/main/preprocess/openpose/run_openpose.py"
click node_openpose "https://github.com/levihsu/ootdiffusion/tree/main/preprocess/openpose/annotator/openpose"
click node_parsing "https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/parsing_api.py"
click node_parse_data "https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/datasets/simple_extractor_dataset.py"
click node_parse_transforms "https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/utils/transforms.py"
click node_parsing_model "https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/networks/AugmentCE2P.py"
click node_hd "https://github.com/levihsu/ootdiffusion/blob/main/ootd/inference_ootd_hd.py"
click node_dc "https://github.com/levihsu/ootdiffusion/blob/main/ootd/inference_ootd_dc.py"
click node_pipeline "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/pipeline_ootd.py"
click node_garm_unet "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_garm_2d_condition.py"
click node_vton_unet "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_vton_2d_condition.py"
click node_garm_blocks "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_garm_2d_blocks.py"
click node_vton_blocks "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_vton_2d_blocks.py"
click node_garm_transformer "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/transformer_garm_2d.py"
click node_vton_transformer "https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/transformer_vton_2d.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_demo,node_helpers,node_user toneBlue
class node_pose,node_openpose,node_parsing,node_parse_data,node_parse_transforms,node_parsing_model toneAmber
class node_hd,node_dc toneMint
class node_pipeline,node_garm_unet,node_vton_unet,node_garm_blocks,node_vton_blocks,node_garm_transformer,node_vton_transformer toneRose
class node_result toneIndigo
```

## Components

### User entrypoints

- [CLI runner](https://github.com/levihsu/ootdiffusion/blob/main/run/run_ootd.py): `run/run_ootd.py`
- [Gradio demo](https://github.com/levihsu/ootdiffusion/blob/main/run/gradio_ootd.py): `run/gradio_ootd.py`
- [Try-on helpers](https://github.com/levihsu/ootdiffusion/blob/main/run/utils_ootd.py): `run/utils_ootd.py`

### Image preparation

- [Pose estimation](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/openpose/run_openpose.py): `preprocess/openpose/run_openpose.py`
- [OpenPose detector](https://github.com/levihsu/ootdiffusion/tree/main/preprocess/openpose/annotator/openpose): `preprocess/openpose/annotator/openpose`
- [Human parsing](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/parsing_api.py): `preprocess/humanparsing/parsing_api.py`
- [Parsing dataset](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/datasets/simple_extractor_dataset.py): `preprocess/humanparsing/datasets/simple_extractor_dataset.py`
- [Parsing transforms](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/utils/transforms.py): `preprocess/humanparsing/utils/transforms.py`
- [Parsing network](https://github.com/levihsu/ootdiffusion/blob/main/preprocess/humanparsing/networks/AugmentCE2P.py): `preprocess/humanparsing/networks/AugmentCE2P.py`

### Try-on inference

- [Half-body model](https://github.com/levihsu/ootdiffusion/blob/main/ootd/inference_ootd_hd.py): `ootd/inference_ootd_hd.py`
- [Full-body model](https://github.com/levihsu/ootdiffusion/blob/main/ootd/inference_ootd_dc.py): `ootd/inference_ootd_dc.py`

### Diffusion components

- [Diffusion pipeline](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/pipeline_ootd.py): `ootd/pipelines_ootd/pipeline_ootd.py`
- [Garment UNet](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_garm_2d_condition.py): `ootd/pipelines_ootd/unet_garm_2d_condition.py`
- [Try-on UNet](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_vton_2d_condition.py): `ootd/pipelines_ootd/unet_vton_2d_condition.py`
- [Garment blocks](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_garm_2d_blocks.py): `ootd/pipelines_ootd/unet_garm_2d_blocks.py`
- [Try-on blocks](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/unet_vton_2d_blocks.py): `ootd/pipelines_ootd/unet_vton_2d_blocks.py`
- [Garment transformer](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/transformer_garm_2d.py): `ootd/pipelines_ootd/transformer_garm_2d.py`
- [Try-on transformer](https://github.com/levihsu/ootdiffusion/blob/main/ootd/pipelines_ootd/transformer_vton_2d.py): `ootd/pipelines_ootd/transformer_vton_2d.py`

### Other components

- **User**
- **Try-on images**

## Connections

- User → CLI runner: provides inputs
- User → Gradio demo: provides inputs
- CLI runner → Try-on helpers: uses helpers (evidence: `run/run_ootd.py`)
- Gradio demo → Try-on helpers: uses helpers (evidence: `run/gradio_ootd.py`)
- CLI runner → Pose estimation: requests pose (evidence: `run/run_ootd.py`)
- CLI runner → Human parsing: requests parsing (evidence: `run/run_ootd.py`)
- Gradio demo → Pose estimation: requests pose (evidence: `run/gradio_ootd.py`)
- Gradio demo → Human parsing: requests parsing (evidence: `run/gradio_ootd.py`)
- Pose estimation → OpenPose detector: runs detector (evidence: `preprocess/openpose/run_openpose.py`)
- Human parsing → Parsing dataset: loads dataset (evidence: `preprocess/humanparsing/parsing_api.py`)
- Human parsing → Parsing transforms: uses transforms (evidence: `preprocess/humanparsing/parsing_api.py`)
- Human parsing → Parsing network: runs network
- CLI runner → Half-body model: selects model (evidence: `run/run_ootd.py`)
- CLI runner → Full-body model: selects model (evidence: `run/run_ootd.py`)
- Gradio demo → Half-body model: selects model (evidence: `run/gradio_ootd.py`)
- Gradio demo → Full-body model: selects model (evidence: `run/gradio_ootd.py`)
- Half-body model → Diffusion pipeline: invokes pipeline (evidence: `ootd/inference_ootd_hd.py`)
- Full-body model → Diffusion pipeline: invokes pipeline (evidence: `ootd/inference_ootd_dc.py`)
- Diffusion pipeline → Garment UNet: uses garment UNet (evidence: `ootd/pipelines_ootd/pipeline_ootd.py`)
- Diffusion pipeline → Try-on UNet: uses try-on UNet (evidence: `ootd/pipelines_ootd/pipeline_ootd.py`)
- Garment UNet → Garment blocks: dispatches blocks (evidence: `ootd/pipelines_ootd/unet_garm_2d_condition.py`)
- Try-on UNet → Try-on blocks: dispatches blocks (evidence: `ootd/pipelines_ootd/unet_vton_2d_condition.py`)
- Garment blocks → Garment transformer: uses transformer (evidence: `ootd/pipelines_ootd/unet_garm_2d_blocks.py`)
- Try-on blocks → Try-on transformer: uses transformer (evidence: `ootd/pipelines_ootd/unet_vton_2d_blocks.py`)
- Diffusion pipeline → Try-on images: returns images (evidence: `ootd/pipelines_ootd/pipeline_ootd.py`)
