Image-to-Image
English
liushanyuan18 commited on
Commit
0ab275d
·
verified ·
1 Parent(s): b6ede8e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +219 -3
README.md CHANGED
@@ -1,3 +1,219 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ # End2End Virtual Tryon with Visual Reference
5
+
6
+
7
+ ![examples](examples.png)
8
+
9
+ We propose **EVTAR**, an End-to-End Virtual Try-on model with Additional Visual Reference, that directly fits the target garment onto the person image while incorporating reference images to enhance the model's ability to preserve and accurately depict clothing details.
10
+
11
+
12
+
13
+
14
+ ## 💡 Update
15
+
16
+ - [x] [2025.10.11] Release the virtual try-on inference code and LoRA weights.
17
+
18
+ - [x] [2025.10.13] Release the technical report on Arxiv.
19
+
20
+
21
+
22
+
23
+
24
+ ## 💪 Highlight Feature
25
+
26
+
27
+
28
+ - **And End-To-End virtual try-on model:** Can function either as an inpainting model for placing the target clothing into masked areas, or as a direct garment transfer onto the human body.
29
+
30
+ - **Using Reference Image To Enhance the Try-on Performance:** To emulate human attention on the overall wearing effect rather than the garment itself when shopping online, our model allows using images of a model wearing the target clothing as input, thereby better preserving its material texture and design details.
31
+
32
+ - **Improved Performance** Our model achieves state-of-the-art performance on public benchmarks and demonstrates strong generalization ability to in-the-wild inputs.
33
+
34
+
35
+
36
+ ## 🧩 Environment Setup
37
+
38
+
39
+
40
+ ```
41
+
42
+ conda create -n EVTAR python=3.12 -y
43
+ conda activate EVTAR
44
+ pip install -r requirements.txt
45
+
46
+ ```
47
+
48
+
49
+
50
+ ## 📂 Preparation of Dataset and Pretrained Models
51
+
52
+
53
+
54
+ ### Dataset
55
+
56
+
57
+
58
+ Currently, we provide a small test set with reference images for trying our model. We plan to release the reference data generation code, along with our proposed full dataset containing model reference images, in the future.
59
+
60
+ Nevertheless, inference can still be performed in a reference-free setting on public benchmarks, including [VITON-HD](https://github.com/shadow2496/VITON-HD) and [DressCode](https://github.com/aimagelab/dress-code).
61
+
62
+ ### Reference Data Preparation
63
+
64
+ One key feature of our method is the use of _reference data_, where an image of a different person wearing the target garment is provided to help the model imagine how the target person would look in that garment. In most online shopping applications, such reference images are commonly used by customers to better visualize the clothing. However, publicly available datasets such as VITON-HD and DressCode do not include such reference data, so we generate them ourselves.
65
+
66
+
67
+
68
+ Please prepare the pretrained weights of the Flux-Kontext model and the Qwen2.5-VL-32B model. And you can generate the reference image using the following commands:
69
+
70
+ ```
71
+
72
+ accelerate launch --num_processes 8 --main_process_port 29500 generate_reference.py \
73
+ --instance_data_dir "path_to_your_datasets" \
74
+ --inference_batch_size 1 \
75
+ --split "train" \
76
+ --desc_path "desc.json"
77
+
78
+ ```
79
+
80
+
81
+
82
+ ### Pretrained Models
83
+
84
+ We provide pretrained backbone networks and LoRA weights for testing and deployment. Please download the `.safetensors` files from [here] and place them in the `checkpoints` directory.
85
+
86
+
87
+
88
+
89
+
90
+ ## ⏳ Inference Pipeline
91
+
92
+
93
+
94
+ Here we provide the inference code for our EVTAR.
95
+
96
+ ```
97
+
98
+ accelerate launch --num_processes 8 --main_process_port 29500 inference.py \
99
+ --pretrained_model_name_or_path="[path_to_your_Flux_model]" \
100
+ --instance_data_dir="[your_data_directory]" \
101
+ --output_dir="[Path_to_LoRA_weights]" \
102
+ --mixed_precision="bf16" \
103
+ --split="test" \
104
+ --height=1024 \
105
+ --width=768 \
106
+ --inference_batch_size=1 \
107
+ --cond_scale=2 \
108
+ --seed="0" \
109
+ --use_reference \
110
+ --use_different \
111
+ --use_person
112
+
113
+ ```
114
+
115
+ - `pretrained_model_name_or_path`: Path to the downloaded Flux-Kontext model weights.
116
+
117
+ - `instance_data_dir`: Path to your dataset. For inference on VITON-HD or DressCode, ensure that the words "viton" or "DressCode" appear in the path.
118
+
119
+ - `output_dir`: Path to the downloaded or trained LoRA weights.
120
+
121
+ - `cond_scale`: Resize scale of the reference image during training. Defaults to `1.0` for $512\times384$ and `2.0` for $1024\times768$ resolution.
122
+
123
+ - `use_reference`: Whether to use a reference model image.
124
+
125
+ - `use_different`: **Only applicable for VITON/DressCode inference.** Whether to use different cloth-person pairs.
126
+
127
+ - `use_person`: **Only applicable for VITON/DressCode inference.** Whether to use the unmasked person image instead of the agnostic masked image as input for the virtual try-on task.
128
+
129
+
130
+
131
+ ## 🚀 Training Pipeline
132
+
133
+ After the preparation of datasets, you can training the virtual-try-on model using following code.
134
+
135
+ ```
136
+
137
+ accelerate launch --num_processes 8 --main_process_port 29501\
138
+
139
+ train_lora_flux_kontext_1st_stage.py \
140
+ --pretrained_model_name_or_path="[path_to_your_Flux_model]" \
141
+ --instance_data_dir="[path_to_your_datasets]" \
142
+ --split="train" \
143
+ --output_dir="[path_to_save_your_LoRA_weights]" \
144
+ --mixed_precision="bf16" \
145
+ --height=1024 \
146
+ --width=768 \
147
+ --train_batch_size=8 \
148
+ --guidance_scale=1 \
149
+ --gradient_checkpointing \
150
+ --optimizer="adamw" \
151
+ --rank=64 \
152
+ --lora_alpha=128 \
153
+ --use_8bit_adam \
154
+ --learning_rate=1e-4 \
155
+ --lr_scheduler="constant" \
156
+ --lr_warmup_steps=0 \
157
+ --num_train_epochs=64 \
158
+ --cond_scale=2 \
159
+ --seed="0" \
160
+ --dropout_reference=0.5 \
161
+ --person_prob=0.5
162
+
163
+ ```
164
+
165
+ - `cond_scale`: Scaling factor for resizing the reference image during training.
166
+
167
+ Defaults to `1.0` for $512\times384$ resolution and `2.0` for $1024\times768$.
168
+
169
+ - `dropout_reference`: Probability of using reference images in each training iteration.
170
+
171
+ When not selected, the iteration proceeds **without** reference images.
172
+
173
+ - `person_prob`: Probability of using unmasked person images in each training iteration.
174
+
175
+ Otherwise, the iteration uses **agnostic images**, where the target clothing region is masked out.
176
+
177
+
178
+
179
+
180
+ ## 📊 Evaluation
181
+
182
+ We quantatitivly evaluate the quality of virtual try-on results using the FID, KID, SSIM, and LPIPS. Here we provide the evaluation code for VITON-HD and DressCode datasets.
183
+
184
+
185
+
186
+ ```
187
+
188
+ # Evaluation on VITON-HD dataset
189
+ CUDA_VISIBLE_DEVICES=0 python eval_dresscode.py \
190
+ --gt_folder_base [path_to_your_ground_truth_image_folder] \
191
+ --pred_folder_base [[path_to_your_generated_image_folder]]\
192
+ --paired
193
+
194
+ ```
195
+
196
+
197
+
198
+ ```
199
+
200
+ # Evaluation on DressCode dataset
201
+ CUDA_VISIBLE_DEVICES=0 python eval.py \
202
+ --gt_folder_base [path_to_your_ground_truth_image_folder] \
203
+ --pred_folder_base [[path_to_your_generated_image_folder]]\
204
+
205
+ ```
206
+
207
+ - `paired`: If you are performing unpaired generation, where different garments are fitted onto the target person, you should enable this flag during evaluation.
208
+
209
+
210
+
211
+ ## 🌸 Acknowledgement
212
+
213
+ This code is mainly built upon [diffusers](https://github.com/huggingface/diffusers/tree/main), [Flux](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines/flux), and [CatVTON](https://github.com/Zheng-Chong/CatVTON/) repositories. Thanks so much for their solid work!
214
+
215
+
216
+
217
+ ## 💖 Citation
218
+
219
+ If you find this repository useful, please consider citing our paper: