# ixarchakos/try-off-anyone architecture

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

- Interactive diagram: https://gitdiagram.com/ixarchakos/try-off-anyone
- Repository: https://github.com/ixarchakos/try-off-anyone

## Overview

#### Purpose and execution modes
TryOffAnyone is a Python computer-vision inference/evaluation repository for generating a tiled garment image from an image of a dressed person, targeting upper-body clothing compatible with VITON-HD. The CLI entry point is `main.py`, with two primary modes: URL-based inference and VITON-HD evaluation.

#### Orchestration and configuration
`main.py` parses mode-specific arguments and dispatches into inference or test flows. `config.py` centralizes runtime device selection, including CUDA-like defaults and Apple MPS support. This is a local, batch-oriented application rather than a web service.
- `main.py`
- `config.py`

#### Input acquisition and preprocessing
Inference accepts a remote image URL, while evaluation consumes the locally extracted VITON-HD dataset. Preprocessing prepares person images and associated representations/masks required by the model pipeline. Generated inputs and outputs are rooted under `data/`.
- `src/inference.py`
- `src/preprocessing.py`
- `data/download_viton_hd`

#### Generative model pipeline
The core model execution is organized as a pipeline that transforms prepared dressed-person inputs into cloth-generation outputs. Custom attention logic is a material architectural component of this pipeline, likely implementing the tiled/detail-preserving behavior described by the project.
- `src/model/pipeline.py`
- `src/model/attention.py`

#### Inference output boundary
The inference layer bridges external image retrieval, preprocessing, checkpoint-backed model execution, and writing generated results to the local data directory. The external dependency boundary is an arbitrary HTTP image host supplied through `--url`; outputs are persisted rather than returned through an API.
- `src/inference.py`
- `src/preprocessing.py`
- `data`

#### Checkpoints and external model distribution
Model weights are not committed as source code; they are expected beneath `ckpt/` and downloaded from Hugging Face. `ckpt/download_checkpoint` represents the checkpoint acquisition boundary. Correct execution depends on compatible downloaded weights and installed Python ML dependencies from `requirements.txt`.
- `ckpt/download_checkpoint`
- `ckpt`
- `requirements.txt`

#### Evaluation and metrics
The test path evaluates generated results against VITON-HD samples and externally supplied cloth masks. Test orchestration is separated from metric/statistics calculation, enabling dataset-scale evaluation rather than only single-image inference.
- `src/test_vton.py`
- `src/stats/metrics.py`
- `src/stats/calculate_statistics.py`

#### Runtime and infrastructure
The repository runs as a Python process with hardware acceleration selected in `config.py` (including Apple MPS support). It relies on local filesystem storage for datasets, masks, checkpoints, and outputs; Hugging Face hosts model artifacts and masks, while inference may retrieve source images from arbitrary URLs.
- `config.py`
- `data`
- `ckpt`

Main entry points: [`src/model/pipeline.py`](https://github.com/ixarchakos/try-off-anyone/blob/master/src/model/pipeline.py) (Garment generation), [`main.py`](https://github.com/ixarchakos/try-off-anyone/blob/master/main.py) (CLI entry point), [`data`](https://github.com/ixarchakos/try-off-anyone/tree/master/data) (Local data), [`src/test_vton.py`](https://github.com/ixarchakos/try-off-anyone/blob/master/src/test_vton.py) (VITON-HD test runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["CLI Runtime"]
  node_main["CLI entry point<br/>Python CLI<br/>[main.py]"]
  node_config["Device config<br/>runtime configuration<br/>[config.py]"]
  node_requirements["ML dependencies<br/>Python dependencies<br/>[requirements.txt]"]
  node_inference["URL inference<br/>inference flow<br/>[inference.py]"]
end

subgraph group_inputs["Inputs &amp; Storage"]
  node_http_image(("Remote person image<br/>external HTTP host"))
  node_viton_download["VITON-HD extraction<br/>dataset acquisition"]
  node_data[("Local data<br/>filesystem storage")]
  node_preprocessing["Person preprocessing<br/>CV preprocessing<br/>[preprocessing.py]"]
  node_checkpoint_download["Checkpoint download<br/>artifact acquisition"]
  node_checkpoints[("Model checkpoints<br/>local model artifacts")]
end

subgraph group_model["Generation Pipeline"]
  node_pipeline["Garment generation<br/>model pipeline<br/>[pipeline.py]"]
  node_attention["Custom attention<br/>model component<br/>[attention.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_test_vton["VITON-HD test runner<br/>evaluation orchestration<br/>[test_vton.py]"]
  node_metrics["Image metrics<br/>metric calculations<br/>[metrics.py]"]
  node_statistics["Evaluation statistics<br/>result aggregation"]
end

node_main -->|"loads device settings"| node_config
node_main -->|"URL mode"| node_inference
node_main -->|"evaluation mode"| node_test_vton
node_requirements -.->|"runtime environment"| node_main
node_http_image -->|"downloads source image"| node_inference
node_inference -->|"prepares person input"| node_preprocessing
node_viton_download -->|"extracts dataset"| node_data
node_data -->|"person images and masks"| node_preprocessing
node_preprocessing -->|"prepared representations"| node_pipeline
node_checkpoint_download -->|"stores weights"| node_checkpoints
node_checkpoints -->|"loads model weights"| node_pipeline
node_attention -->|"custom attention"| node_pipeline
node_pipeline -->|"writes generated images"| node_data
node_data -->|"VITON-HD samples and cloth masks"| node_test_vton
node_test_vton -->|"runs generation"| node_pipeline
node_test_vton -->|"computes metrics"| node_metrics
node_metrics -->|"aggregates scores"| node_statistics

click node_main "https://github.com/ixarchakos/try-off-anyone/blob/master/main.py"
click node_config "https://github.com/ixarchakos/try-off-anyone/blob/master/config.py"
click node_requirements "https://github.com/ixarchakos/try-off-anyone/blob/master/requirements.txt"
click node_inference "https://github.com/ixarchakos/try-off-anyone/blob/master/src/inference.py"
click node_viton_download "https://github.com/ixarchakos/try-off-anyone/blob/master/data/download_viton_hd"
click node_data "https://github.com/ixarchakos/try-off-anyone/tree/master/data"
click node_preprocessing "https://github.com/ixarchakos/try-off-anyone/blob/master/src/preprocessing.py"
click node_checkpoint_download "https://github.com/ixarchakos/try-off-anyone/blob/master/ckpt/download_checkpoint"
click node_checkpoints "https://github.com/ixarchakos/try-off-anyone/tree/master/ckpt"
click node_pipeline "https://github.com/ixarchakos/try-off-anyone/blob/master/src/model/pipeline.py"
click node_attention "https://github.com/ixarchakos/try-off-anyone/blob/master/src/model/attention.py"
click node_test_vton "https://github.com/ixarchakos/try-off-anyone/blob/master/src/test_vton.py"
click node_metrics "https://github.com/ixarchakos/try-off-anyone/blob/master/src/stats/metrics.py"
click node_statistics "https://github.com/ixarchakos/try-off-anyone/blob/master/src/stats/calculate_statistics.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_main,node_config,node_requirements,node_inference toneBlue
class node_http_image,node_viton_download,node_data,node_preprocessing,node_checkpoint_download,node_checkpoints toneAmber
class node_pipeline,node_attention toneMint
class node_test_vton,node_metrics,node_statistics toneRose
```

## Components

### CLI Runtime

- [CLI entry point](https://github.com/ixarchakos/try-off-anyone/blob/master/main.py): Python CLI · Dispatches URL inference or VITON-HD evaluation. · `main.py`
- [Device config](https://github.com/ixarchakos/try-off-anyone/blob/master/config.py): runtime configuration · Selects CUDA-like devices or Apple MPS. · `config.py`
- [ML dependencies](https://github.com/ixarchakos/try-off-anyone/blob/master/requirements.txt): Python dependencies · `requirements.txt`
- [URL inference](https://github.com/ixarchakos/try-off-anyone/blob/master/src/inference.py): inference flow · Retrieves an image and persists generated output. · `src/inference.py`

### Inputs & Storage

- **Remote person image**: external HTTP host · User-supplied image URL.
- [VITON-HD extraction](https://github.com/ixarchakos/try-off-anyone/blob/master/data/download_viton_hd): dataset acquisition · `data/download_viton_hd`
- [Local data](https://github.com/ixarchakos/try-off-anyone/tree/master/data): filesystem storage · Holds datasets, prepared inputs, masks, and outputs. · `data`
- [Person preprocessing](https://github.com/ixarchakos/try-off-anyone/blob/master/src/preprocessing.py): CV preprocessing · Builds person representations and masks for generation. · `src/preprocessing.py`
- [Checkpoint download](https://github.com/ixarchakos/try-off-anyone/blob/master/ckpt/download_checkpoint): artifact acquisition · Downloads compatible model weights from Hugging Face. · `ckpt/download_checkpoint`
- [Model checkpoints](https://github.com/ixarchakos/try-off-anyone/tree/master/ckpt): local model artifacts · `ckpt`

### Generation Pipeline

- [Garment generation](https://github.com/ixarchakos/try-off-anyone/blob/master/src/model/pipeline.py): model pipeline · Transforms prepared dressed-person inputs into tiled garment images. · `src/model/pipeline.py`
- [Custom attention](https://github.com/ixarchakos/try-off-anyone/blob/master/src/model/attention.py): model component · Detail-preserving attention used by the generation pipeline. · `src/model/attention.py`

### Evaluation

- [VITON-HD test runner](https://github.com/ixarchakos/try-off-anyone/blob/master/src/test_vton.py): evaluation orchestration · Runs dataset-scale generation and evaluation. · `src/test_vton.py`
- [Image metrics](https://github.com/ixarchakos/try-off-anyone/blob/master/src/stats/metrics.py): metric calculations · `src/stats/metrics.py`
- [Evaluation statistics](https://github.com/ixarchakos/try-off-anyone/blob/master/src/stats/calculate_statistics.py): result aggregation · `src/stats/calculate_statistics.py`

## Connections

- CLI entry point → Device config: loads device settings
- CLI entry point → URL inference: URL mode
- CLI entry point → VITON-HD test runner: evaluation mode
- ML dependencies → CLI entry point: runtime environment
- Remote person image → URL inference: downloads source image
- URL inference → Person preprocessing: prepares person input
- VITON-HD extraction → Local data: extracts dataset
- Local data → Person preprocessing: person images and masks
- Person preprocessing → Garment generation: prepared representations
- Checkpoint download → Model checkpoints: stores weights
- Model checkpoints → Garment generation: loads model weights
- Custom attention → Garment generation: custom attention
- Garment generation → Local data: writes generated images
- Local data → VITON-HD test runner: VITON-HD samples and cloth masks
- VITON-HD test runner → Garment generation: runs generation
- VITON-HD test runner → Image metrics: computes metrics
- Image metrics → Evaluation statistics: aggregates scores
