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-On
|
| 3 |
+
emoji: ๐
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
python_version: 3.10
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# FASHN VTON v1.5: Efficient Maskless Virtual Try-On in Pixel Space
|
| 13 |
+
|
| 14 |
+
<div align="center">
|
| 15 |
+
<a href="https://fashn.ai/research/vton-1-5"><img src='https://img.shields.io/badge/Project-Page-1A1A1A?style=flat' alt='Project Page'></a> 
|
| 16 |
+
<a href='https://huggingface.co/fashn-ai/fashn-vton-1.5'><img src='https://img.shields.io/badge/Hugging%20Face-Model-FFD21E?style=flat&logo=HuggingFace&logoColor=FFD21E' alt='Hugging Face Model'></a> 
|
| 17 |
+
<a href="https://huggingface.co/spaces/fashn-ai/fashn-vton-1.5"><img src='https://img.shields.io/badge/Hugging%20Face-Spaces-FFD21E?style=flat&logo=HuggingFace&logoColor=FFD21E' alt='Hugging Face Spaces'></a> 
|
| 18 |
+
<a href=""><img src='https://img.shields.io/badge/arXiv-Coming%20Soon-b31b1b?style=flat&logo=arXiv&logoColor=b31b1b' alt='arXiv'></a> 
|
| 19 |
+
<a href="LICENSE"><img src='https://img.shields.io/badge/License-Apache--2.0-gray?style=flat' alt='License'></a>
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
by [FASHN AI](https://fashn.ai)
|
| 23 |
+
|
| 24 |
+
Virtual try-on model that generates photorealistic images directly in pixel space without requiring segmentation masks.
|
| 25 |
+
|
| 26 |
+
<p align="center">
|
| 27 |
+
<img src="https://static.fashn.ai/repositories/fashn-vton-v15/results/hero_collage.webp" alt="FASHN VTON v1.5 examples" width="900">
|
| 28 |
+
</p>
|
| 29 |
+
|
| 30 |
+
This repo contains minimal inference code to run virtual try-on with the FASHN VTON v1.5 model weights. Given a person image and a garment image, the model generates a photorealistic image of the person wearing the garment. Supports both model photos and flat-lay product shots as garment inputs.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## Local Installation
|
| 35 |
+
|
| 36 |
+
We recommend using a virtual environment:
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
git clone https://github.com/fashn-AI/fashn-vton-1.5.git
|
| 40 |
+
cd fashn-vton-1.5
|
| 41 |
+
python -m venv .venv && source .venv/bin/activate
|
| 42 |
+
pip install -e .
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
**Note:** Installation includes `onnxruntime-gpu` for GPU-accelerated pose detection. Ensure CUDA is properly configured on your system. For CPU-only environments, replace with the CPU version:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
pip uninstall onnxruntime-gpu && pip install onnxruntime
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## Model Weights
|
| 54 |
+
|
| 55 |
+
Download the required model weights (~2 GB total):
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
python scripts/download_weights.py --weights-dir ./weights
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
This downloads:
|
| 62 |
+
- `model.safetensors` โ TryOnModel weights from [HuggingFace](https://huggingface.co/fashn-ai/fashn-vton-1.5)
|
| 63 |
+
- `dwpose/` โ DWPose ONNX models for pose detection
|
| 64 |
+
|
| 65 |
+
**Note:** The human parser weights (~244 MB) are automatically downloaded on first use to the HuggingFace cache folder. Set `HF_HOME` to customize the location.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## Usage
|
| 70 |
+
|
| 71 |
+
```python
|
| 72 |
+
from fashn_vton import TryOnPipeline
|
| 73 |
+
from PIL import Image
|
| 74 |
+
|
| 75 |
+
# Initialize pipeline (automatically uses GPU if available)
|
| 76 |
+
pipeline = TryOnPipeline(weights_dir="./weights")
|
| 77 |
+
|
| 78 |
+
# Load images
|
| 79 |
+
person = Image.open("examples/data/model.webp").convert("RGB")
|
| 80 |
+
garment = Image.open("examples/data/garment.webp").convert("RGB")
|
| 81 |
+
|
| 82 |
+
# Run inference
|
| 83 |
+
result = pipeline(
|
| 84 |
+
person_image=person,
|
| 85 |
+
garment_image=garment,
|
| 86 |
+
category="tops", # "tops" | "bottoms" | "one-pieces"
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# Save output
|
| 90 |
+
result.images[0].save("output.png")
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### CLI
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
python examples/basic_inference.py \
|
| 97 |
+
--weights-dir ./weights \
|
| 98 |
+
--person-image examples/data/model.webp \
|
| 99 |
+
--garment-image examples/data/garment.webp \
|
| 100 |
+
--category tops
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
**Note:** The pipeline automatically uses GPU if available. The try-on model weights are stored in bfloat16 and will run in bf16 precision on Ampere+ GPUs (RTX 30xx/40xx, A100, H100). On older hardware or CPU, weights are converted to float32.
|
| 104 |
+
|
| 105 |
+
See [`examples/basic_inference.py`](examples/basic_inference.py) for additional options.
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## Categories
|
| 110 |
+
|
| 111 |
+
| Category | Description |
|
| 112 |
+
|----------|-------------|
|
| 113 |
+
| `tops` | Upper body: t-shirts, blouses, jackets |
|
| 114 |
+
| `bottoms` | Lower body: pants, skirts, shorts |
|
| 115 |
+
| `one-pieces` | Full body: dresses, jumpsuits |
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## API
|
| 120 |
+
|
| 121 |
+
FASHN provides a suite of [fashion AI APIs](https://fashn.ai/products/api) including virtual try-on, model generation, image-to-video, and more. See the [docs](https://docs.fashn.ai/) to get started.
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Citation
|
| 126 |
+
|
| 127 |
+
If you use FASHN VTON v1.5 in your research, please cite:
|
| 128 |
+
|
| 129 |
+
```bibtex
|
| 130 |
+
@article{bochman2026fashnvton,
|
| 131 |
+
title={FASHN VTON v1.5: Efficient Maskless Virtual Try-On in Pixel Space},
|
| 132 |
+
author={Bochman, Dan and Bochman, Aya},
|
| 133 |
+
journal={arXiv preprint},
|
| 134 |
+
year={2026},
|
| 135 |
+
note={Paper coming soon}
|
| 136 |
+
}
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
## License
|
| 142 |
+
|
| 143 |
+
Apache-2.0. See [LICENSE](LICENSE) for details.
|
| 144 |
+
|
| 145 |
+
**Third-party components:**
|
| 146 |
+
- [DWPose](https://github.com/IDEA-Research/DWPose) (Apache-2.0)
|
| 147 |
+
- [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) (Apache-2.0)
|
| 148 |
+
- [fashn-human-parser](https://github.com/fashn-AI/fashn-human-parser) ([License](https://github.com/fashn-AI/fashn-human-parser?tab=readme-ov-file#license))
|
| 149 |
+
|