How ixarchakos/try-off-anyone works
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: pipeline.py Garment generation · main.py CLI entry point · data Local data · test_vton.py VITON-HD test runner
Components 15
CLI Runtime
- CLI entry point · Dispatches URL inference or VITON-HD evaluation.
main.py - Device config · Selects CUDA-like devices or Apple MPS.
config.py - ML dependencies
requirements.txt - URL inference · Retrieves an image and persists generated output.
src/inference.py
Inputs & Storage
- Remote person image · User-supplied image URL.
- VITON-HD extraction
data/download_viton_hd - Local data · Holds datasets, prepared inputs, masks, and outputs.
data - Person preprocessing · Builds person representations and masks for generation.
src/preprocessing.py - Checkpoint download · Downloads compatible model weights from Hugging Face.
ckpt/download_checkpoint - Model checkpoints
ckpt
Generation Pipeline
- Garment generation · Transforms prepared dressed-person inputs into tiled garment images.
src/model/pipeline.py - Custom attention · Detail-preserving attention used by the generation pipeline.
src/model/attention.py
Evaluation
- VITON-HD test runner · Runs dataset-scale generation and evaluation.
src/test_vton.py - Image metrics
src/stats/metrics.py - Evaluation statistics
src/stats/calculate_statistics.py
Connections 17
- 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