Skip to content
forked from xiezhy6/GP-VTON

Official Implementation for CVPR2023 paper "GP-VTON: Towards General Purpose Virtual Try-on via Collaborative Local-Flow Global-Parsing Learning"

Notifications You must be signed in to change notification settings

EricShow/GP-VTON

 
 

Repository files navigation

GP-VTON: Towards General Purpose Virtual Try-on via Collaborative Local-Flow Global-Parsing Learning

1Shenzhen Campus of Sun Yat-Sen University  2ByteDance
3Carnegie Mellon University  4Peng Cheng Laboratory

Paper | Project Page

GP-VTON aims to transfer an in-shop garment onto a specific person.

Fine-grained Parsing

We provide the fine-grained parsing result of the model images and in-shop garment images from two existing high-resolution (1024 x 768) virtual try-on benchmarks, namely, VITON-HD and DressCode.

We provide two version of the parsing results. One is with the original resolution (1024 x 768). Another is with the resolution of 512 x 384, on which our experiment are conducted.

VITON-HD

Resolution Google Cloud Baidu Yun
1024 x 768 Available soon Available soon
512 x 384 Download Download

DressCode

Resolution Google Cloud Baidu Yun
1024 x 768 Download Download
512 x 384 Download Download

Environment Setup

Install required packages:

pip3 install -r requirements.txt

Dataset

We conduct experiments on the publicly available VITON-HD and DressCode datasets. For convenience, we provide all of the conditions used in our experiments in the following links.

Resolution Google Cloud Baidu Yun
VITON-HD(512 x 384) Download Download
DressCode(512 x 384) Download (coming soon) Download (coming soon)

Inference

VITON-HD

Please download the pre-trained model from Google Link or Baidu Yun Link, and put the downloaded directory under root directory of this project.

To test the first stage (i.e., the LFGP warping module), run the following command:

python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=4739 test_warping.py \
    --name test_partflow_vitonhd_unpaired_1109 \
    --PBAFN_warp_checkpoint 'checkpoints/gp-vton_partflow_vitonhd_usepreservemask_lrarms_1027/PBAFN_warp_epoch_121.pth' \
    --resize_or_crop None --verbose --tf_log \
    --batchSize 2 --num_gpus 8 --label_nc 14 --launcher pytorch \
    --dataroot /home/tiger/datazy/CVPR2023/Datasets/VITONHD \
    --image_pairs_txt test_pairs_unpaired_1018.txt

To test the second stage (i.e., the try-on generator), run the following command:

python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=4736 test_tryon.py \
    --name test_gpvtongen_vitonhd_unpaired_1109 \
    --resize_or_crop None --verbose --tf_log --batchSize 12 --num_gpus 8 --label_nc 14 --launcher pytorch \
    --PBAFN_gen_checkpoint 'checkpoints/gp-vton_gen_vitonhd_wskin_wgan_lrarms_1029/PBAFN_gen_epoch_201.pth' \
    --dataroot /home/tiger/datazy/CVPR2023/Datasets/VITONHD \
    --image_pairs_txt test_pairs_unpaired_1018.txt \
    --warproot /home/tiger/datazy/CVPR2023/GP-VTON-partflow_final_kaiwu/sample/test_partflow_vitonhd_unpaired_1109

Note that, in the above two commands, parameter --dataroot refers to the root directory of VITON-HD dataset, parameter --image_pairs_txt refers to the test list, which is put under the root directory of VITON-HD dataset, parameter --warproot in the second command refers to the directory of the warped results generated by the first command. Both of the generated results from the two commands are saved under the directory ./sample/exp_name, in which exp_name is defined by the parameter --name in each command.

Training

VITON-HD

To train the first stage (i.e., the LFGP warping module), run the following command:

python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=7129 train_warping.py \
    --name gp-vton_partflow_vitonhd_usepreservemask_lrarms_1027 \
    --resize_or_crop None --verbose --tf_log \
    --batchSize 2 --num_gpus 8 --label_nc 14 --launcher pytorch  \
    --dataroot /home/tiger/datazy/CVPR2023/Datasets/VITONHD \
    --image_pairs_txt train_pairs_1018.txt \
    --display_freq 320 --print_freq 160 --save_epoch_freq 10 --write_loss_frep 320 \
    --niter_decay 50 --niter 70  --mask_epoch 70 \
    --lr 0.00005

To train the second stage (i.e., the try-on generator), we first need to run the following command to generate the warped results for the flat garments in the training set:

python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=4739 test_warping.py \
    --name test_gpvton_lrarms_for_training_1029 \
    --PBAFN_warp_checkpoint 'checkpoints/gp-vton_partflow_vitonhd_usepreservemask_lrarms_1027/PBAFN_warp_epoch_121.pth' \
    --resize_or_crop None --verbose --tf_log \
    --batchSize 2 --num_gpus 8 --label_nc 14 --launcher pytorch \
    --dataroot /home/tiger/datazy/CVPR2023/Datasets/VITONHD \
    --image_pairs_txt train_pairs_1018.txt

The warped results will saved in the directory sample/test_gpvton_lrarms_for_training_1029. Thus run the following command for training:

python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=4736 train_tryon.py \
    --name gp-vton_gen_vitonhd_wskin_wgan_lrarms_1029 \
    --resize_or_crop None --verbose --tf_log --batchSize 10 --num_gpus 8 --label_nc 14 --launcher pytorch \
    --dataroot /home/tiger/datazy/CVPR2023/Datasets/VITONHD \
    --image_pairs_txt train_pairs_1018.txt \
    --warproot sample/test_gpvton_lrarms_for_training_1029 \
    --display_freq 50 --print_freq 25 --save_epoch_freq 10 --write_loss_frep 25 \
    --niter_decay 0 --niter 200 \
    --lr 0.0005

Todo

  • Release the ground truth of the garment parsing and human parsing for two public benchmarks (VITON-HD and DressesCode) used in the paper
  • Release the the pretrained model and the inference script for VITON-HD dataset.
  • Release the the pretrained model and the inference script for DressCode dataset.
  • Release the training script for VITON-HD dataset.
  • Release the training script for DressCode dataset.

Citation

If you find our code or paper helps, please consider citing:

@inproceedings{xie2023gpvton,
  title     = {GP-VTON: Towards General Purpose Virtual Try-on via Collaborative Local-Flow Global-Parsing Learning},
  author    = {Zhenyu, Xie and Zaiyu, Huang and Xin, Dong and Fuwei, Zhao and Haoye, Dong and Xijin, Zhang and Feida, Zhu and Xiaodan, Liang},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  month     = {June},
  year      = {2023},
}

Acknowledgments

Thanks to PF-AFN, our code is based on it.

License

The use of this code is RESTRICTED to non-commercial research and educational purposes.

About

Official Implementation for CVPR2023 paper "GP-VTON: Towards General Purpose Virtual Try-on via Collaborative Local-Flow Global-Parsing Learning"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.3%
  • Shell 1.7%