File size: 6,433 Bytes
42b03f7
 
 
005b7ff
42b03f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# IJCV (2025): TryOn-Adapter
This repository is the official implementation of [TryOn-Adapter](https://arxiv.org/abs/2404.00878)

TryOn-Adapter: Efficient Fine-Grained Clothing Identity Adaptation for High-Fidelity Virtual Try-On<br>

>
> Jiazheng Xing, Chao Xu, Yijie Qian, Yang Liu, Guang Dai, Baigui Sun, Yong Liu, Jingdong Wang

[[arXiv Paper](https://arxiv.org/abs/2404.00878)]&nbsp;

![teaser](assets/teaser.jpg)&nbsp;

## TODO List
- [x] ~~Release Texture Highlighting Map and Segmentation Map~~
- [x] ~~Release Data Preparation Code~~
- [x] ~~Release Inference Code~~
- [x] ~~Release Model Weights~~ 

## Getting Started
### Installation
1. Clone the repository
```shell
git clone https://github.com/jiazheng-xing/TryOn-Adapter.git
cd TryOn-Adapter
```
2. Install Python dependencies
```shell
conda env create -f environment.yaml
conda activate tryon-adapter
```

### Data Preparation
#### VITON-HD
1. The VITON-HD dataset serves as a benchmark. Download [VITON-HD](https://github.com/shadow2496/VITON-HD) dataset.

2. In addition to above content, some other preprocessed conditions are in use in TryOn-Adapter.  The preprocessed data could be downloaded, respectively. The detail information and code see [data_preparation/README.md](data_preparation/README.md). 

   |Content|Google|Baidu|
   |---|---|---|
   |Segmentation Map|[link](https://drive.google.com/file/d/18KvGWR-3siJ_mt7g4CcEVFi_51E7ZifA/view?usp=sharing)|[link](https://pan.baidu.com/s/1zm3XV34tcrXpYt6uAN4R9Q?pwd=ekyn)|
   |Highlighting Texture Map|[link](https://drive.google.com/file/d/111KBYA8-d9xl9a2aS9yUaTp0edflb7qT/view?usp=sharing)|[link](https://pan.baidu.com/s/1xWnvF7TeKB_2AzlCEbPsAQ?pwd=jnlz)|

3. Generate Warped Cloth and Warped Mask based on the [GP-VTON](https://github.com/xiezhy6/GP-VTON.git).

Once everything is set up, the folders should be organized like this:
```
β”œβ”€β”€ VITON-HD
|   β”œβ”€β”€ test_pairs.txt
|   β”œβ”€β”€ train_pairs.txt
β”‚   β”œβ”€β”€ [train | test]
|   |   β”œβ”€β”€ image
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00.jpg | 000008_00.jpg | ...]
β”‚   β”‚   β”œβ”€β”€ cloth
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00.jpg | 000008_00.jpg | ...]
β”‚   β”‚   β”œβ”€β”€ cloth-mask
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00.jpg | 000008_00.jpg | ...]
β”‚   β”‚   β”œβ”€β”€ image-parse-v3
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00.png | 000008_00.png | ...]
β”‚   β”‚   β”œβ”€β”€ openpose_img
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00_rendered.png | 000008_00_rendered.png | ...]
β”‚   β”‚   β”œβ”€β”€ openpose_json
β”‚   β”‚   β”‚   β”œβ”€β”€ [000006_00_keypoints.json | 000008_00_keypoints.json | ...]
β”‚   β”‚   β”œβ”€β”€ train_paired/test_(un)paired
β”‚   β”‚   β”‚   β”œβ”€β”€ mask      [000006_00.png | 000008_00.png | ...]
β”‚   β”‚   β”‚   β”œβ”€β”€ seg_preds [000006_00.png | 000008_00.png | ...]
β”‚   β”‚   β”‚   β”œβ”€β”€ warped    [000006_00.png | 000008_00.png | ...]
```

#### DressCode
1. The DressCode dataset serves as a benchmark. Download the [DressCode](https://github.com/aimagelab/dress-code) dataset.

2. In addition to above content, some other preprocessed conditions are in use in TryOn-Adapter. The detail information and code see [data_preparation/README.md](data_preparation/README.md). 

3. Generate Warped Cloth and Warped Mask based on the [GP-VTON](https://github.com/xiezhy6/GP-VTON.git).

Once everything is set up, the folders should be organized like this:
```
β”œβ”€β”€ DressCode
|   β”œβ”€β”€ test_pairs_paired.txt
|   β”œβ”€β”€ test_pairs_unpaired.txt
|   β”œβ”€β”€ train_pairs.txt
|   β”œβ”€β”€ train_pairs.txt
β”‚   β”œβ”€β”€ [test_paird | test_unpaird | train_paird]
β”‚   β”‚   β”œβ”€β”€ [dresses | lower_body | upper_body]
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ mask      [013563_1.png| 013564_1.png | ...]
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ seg_preds [013563_1.png| 013564_1.png | ...]
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ warped    [013563_1.png| 013564_1.png | ...]
β”‚   β”œβ”€β”€ [dresses | lower_body | upper_body]
|   |   β”œβ”€β”€ test_pairs_paired.txt
|   |   β”œβ”€β”€ test_pairs_unpaired.txt
|   |   β”œβ”€β”€ train_pairs.txt
β”‚   β”‚   β”œβ”€β”€ images
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_0.jpg | 013563_1.jpg | 013564_0.jpg | 013564_1.jpg | ...]
β”‚   β”‚   β”œβ”€β”€ masks
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_1.png| 013564_1.png | ...]
β”‚   β”‚   β”œβ”€β”€ keypoints
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_2.json | 013564_2.json | ...]
β”‚   β”‚   β”œβ”€β”€ label_maps
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_4.png | 013564_4.png | ...]
β”‚   β”‚   β”œβ”€β”€ skeletons
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_5.jpg | 013564_5.jpg | ...]
β”‚   β”‚   β”œβ”€β”€ dense
β”‚   β”‚   β”‚   β”œβ”€β”€ [013563_5.png | 013563_5_uv.npz | 013564_5.png | 013564_5_uv.npz | ...]
```
### Inference
Please download the pretrained model from [HuggingFace](https://huggingface.co/Ockham98/TryOn-Adapter).
To perform inference on the Dress Code or VITON-HD dataset, use the following command:
```shell
python test_viton.py/test_dresscode.py --plms --gpu_id 0 \
--ddim_steps 100 \
--outdir <path> \
--config [configs/viton.yaml | configs/dresscode.yaml] \
--dataroot <path> \
--ckpt <path> \
--ckpt_elbm_path <path> \
--use_T_repaint [True | False] \
--n_samples 1 \
--seed 23 \
--scale 1 \
--H 512 \
--W 512 \
--unpaired
```

```shell
--ddim_steps <int>         sampling steps
--outdir <str>             output direction path
--config <str>             config path of viton-hd/dresscode
--ckpt <str>               diffusion model checkpoint path
--ckpt_elbm_path <str>     elbm module checkpoint dirction path
--use_T_repaint <bool>     whether to use T-Repaint technique
--n_samples <int>          numbers of samples per inference
--unpaired                 whether to use the unpaired setting
```

or just simply run:
```shell
bash test_viton.sh
bash test_dresscode.sh
```


## Acknowledgements
Our code is heavily borrowed from [Paint-by-Example](https://github.com/Fantasy-Studio/Paint-by-Example). We also thank [GP-VTON](https://github.com/xiezhy6/GP-VTON.git), our warping garments are generated from it.

## Citation
```
@article{xing2025tryon,
  title={TryOn-Adapter: Efficient Fine-Grained Clothing Identity Adaptation for High-Fidelity Virtual Try-On},
  author={Xing, Jiazheng and Xu, Chao and Qian, Yijie and Liu, Yang and Dai, Guang and Sun, Baigui and Liu, Yong and Wang, Jingdong},
  journal={International Journal of Computer Vision},
  pages={1--22},
  year={2025},
  publisher={Springer}
}
```