• Stars
    star
    263
  • Rank 150,595 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official implementation for "CP-VTON+: Clothing Shape and Texture Preserving Image-Based Virtual Try-On", CVPRW 2020

CP-VTON+ (CVPRW 2020)

Official implementation for "CP-VTON+: Clothing Shape and Texture Preserving Image-Based Virtual Try-On" from CVPRW 2020.
Project page: https://minar09.github.io/cpvtonplus/.
Saved/Pre-trained models: Checkpoints
Dataset: VITON_PLUS
The code and pre-trained models are tested with pytorch 0.4.1, torchvision 0.2.1, opencv-python 4.1 and pillow 5.4 (Python 3 env).

Project page | Paper | Dataset | Model | Video

Teaser

Usage

This pipeline is a combination of consecutive training and testing of GMM + TOM. GMM generates the warped clothes according to the target human. Then, TOM blends the warped clothes outputs from GMM into the target human properties, to generate the final try-on output.

  1. Install the requirements
  2. Download/Prepare the dataset
  3. Train GMM network
  4. Get warped clothes for training set with trained GMM network, and copy warped clothes & masks inside data/train directory
  5. Train TOM network
  6. Test GMM for testing set
  7. Get warped clothes for testing set, copy warped clothes & masks inside data/test directory
  8. Test TOM testing set

Installation

This implementation is built and tested in PyTorch 0.4.1. Pytorch and torchvision are recommended to install with conda: conda install pytorch=0.4.1 torchvision=0.2.1 -c pytorch
For all packages, run pip install -r requirements.txt

Data preparation

For training/testing VITON dataset, our full and processed dataset is available here: https://1drv.ms/u/s!Ai8t8GAHdzVUiQRFmTPrtrAy0ZP5?e=rS1aK8. After downloading, unzip to your data directory.

Training

Run python train.py with your specific usage options for GMM and TOM stage.
For example, GMM: python train.py --name GMM --stage GMM --workers 4 --save_count 5000 --shuffle
Then run test.py for GMM network with the training dataset, which will generate the warped clothes and masks in "warp-cloth" and "warp-mask" folders inside the "result/GMM/train/" directory. Copy the "warp-cloth" and "warp-mask" folders into your data directory, for example inside "data/train" folder.
Run TOM stage, python train.py --name TOM --stage TOM --workers 4 --save_count 5000 --shuffle

Testing

Run 'python test.py' with your specific usage options.
For example, GMM: python test.py --name GMM --stage GMM --workers 4 --datamode test --data_list test_pairs.txt --checkpoint checkpoints/GMM/gmm_final.pth
Then run test.py for GMM network with the testing dataset, which will generate the warped clothes and masks in "warp-cloth" and "warp-mask" folders inside the "result/GMM/test/" directory. Copy the "warp-cloth" and "warp-mask" folders into your data directory, for example inside "data/test" folder.
Run TOM stage: python test.py --name TOM --stage TOM --workers 4 --datamode test --data_list test_pairs.txt --checkpoint checkpoints/TOM/tom_final.pth

Inference/Demo

Download the pre-trained models from here: https://1drv.ms/u/s!Ai8t8GAHdzVUiQA-o3C7cnrfGN6O?e=EaRiFP. Then run the same step as Testing to test/inference our model. The code and pre-trained models are tested with pytorch 0.4.1, torchvision 0.2.1, opencv 4.1 and pillow 5.4.

Testing with custom images

to run the model with custom internet images, make sure you have the following:

  1. image (image of a person, crop/resize to 192 x 256 (width x height) pixels)
  2. image-parse (you can generate with CIHP_PGN or Graphonomy pretrained networks from the person image. See this comment)
  3. cloth (in-shop cloth image, crop/resize to 192 x 256 (width x height) pixels)
  4. cloth-mask (binary mask of cloth image, you can generate it with simple pillow/opencv function)
  5. pose (pose keypoints of the person, generate with openpose COCO-18 model (OpenPose from the official repository is preferred))
  6. Also, make a test_pairs.txt file for your custom images. Follow the VITON dataset format to keep same arrangements, otherwise you can modify the code.

What to do in case of unexpected results

There are many factors that can make distorted/unexpected results. Can you please do the following?

  1. First try the original viton dataset and test pair combinations, check the intermediate results and the final output. Check if they are as expected.
  2. If the original viton results are not as expected, please check the issues raised in this github repo, people have already found several issues and see how they solved it.
  3. If the original viton test results are as expected, then run your custom test sets and check the intermediate results and debug where its going wrong.
  4. If you are testing with custom images then check the github repository readme and related issues on how to run with custom images.

Its difficult to understand your issue from only single image/output. As I mentioned, there are various factors. Please debug yourself step by step and see where its going wrong. Check all the available intermediate/final inputs/outputs visually, and check multiple cases to see if the issue is happening for all cases. Good luck to you!

Citation

Please cite our paper in your publications if it helps your research:

@InProceedings{Minar_CPP_2020_CVPR_Workshops,
	title={CP-VTON+: Clothing Shape and Texture Preserving Image-Based Virtual Try-On},
	author={Minar, Matiur Rahman and Thai Thanh Tuan and Ahn, Heejune and Rosin, Paul and Lai, Yu-Kun},
	booktitle = {The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
	month = {June},
	year = {2020}
}

Acknowledgements

This implementation is largely based on the PyTorch implementation of CP-VTON. We are extremely grateful for their public implementation.

More Repositories

1

awesome-virtual-try-on

A curated list of awesome research papers, projects, code, dataset, workshops etc. related to virtual try-on.
1,047
star
2

VGG16-PyTorch

VGG16 Net implementation from PyTorch Examples scripts for ImageNet dataset
Shell
67
star
3

ACGPN

"Towards Photo-Realistic Virtual Try-On by Adaptively Generating↔Preserving Image Content",CVPR 2020. (Modified from original with fixes for inference)
Python
65
star
4

Fashion-Clothing-Parsing

FCN, U-Net models implementation in TensorFlow for fashion clothing parsing
Python
32
star
5

bfscore_python

Boundary F1 Score - Python Implementation
Python
20
star
6

LIP-JPPNet-TensorFlow

JPPNet implementation in TensorFlow for human parsing
Python
17
star
7

Clothing-Matching

A repository of tools implemented for 2D clothing matching and alignment for 3D clothing reconstruction and virtual try-on.
Python
12
star
8

pix2surf_windows

Windows running repository of the pix2surf code of the paper "Learning to Transfer Texture from Clothing Images to 3D Humans"
Python
11
star
9

U-Net-Attention

U-Net + Attention, extending U-Net model for semantic segmentation. Implemented with TensorFlow.
Python
9
star
10

PGN_tf

Part Grouping Network (PGN) implementation in TensorFlow, for custom parsing dataset
Python
8
star
11

dataset-CFPD-windows

CFPD | Colorful Fashion Parsing Data for Windows OS
Jupyter Notebook
8
star
12

ASU-Net

ASU-Net: Attention to Scale with U-Net for Semantic Segmentation (Implemented with TensorFlow)
Python
7
star
13

MGN-Py3

Multi-Garment Network implementation for Python3
Python
6
star
14

cloth-human-depth-estimation

Clothing and human depth estimation from "A Neural Network for Detailed Human Depth Estimation from a Single Image"
Python
6
star
15

awesome-deep-learning-techniques

A curated list of awesome deep learning techniques for deep neural networks training, testing, optimization, regularization etc.
6
star
16

openpose-pytorch

openpose implementation in pytorch
Jupyter Notebook
4
star
17

Hospital-Management-System

C#
4
star
18

parallel-computing

Parallel computing: Jacobi and Gauss-Seidel implementation with OpenMP and MPI
C
4
star
19

yolov3-pytorch

yolov3 model in pytorch implementation, customized for single class training and testing
Jupyter Notebook
3
star
20

DRN-PyTorch

PyTorch implementation of Dilated Residual Networks for semantic image segmentation
Python
3
star
21

VGG16-TensorFlow

VGG16 Net TensorFlow Implementation for ImageNet2012 dataset
Python
2
star
22

street2shop-dataset

Scripts for collecting Street2Shop fashion/clothing dataset
Python
2
star
23

OpenGL-Mega-Structure-Texture-Lighting-C-

OpenGL Mega Structure Texture & Lighting in C++
C++
2
star
24

MvcCoreMovie

ASP .NET Core MVC
C#
1
star
25

islam

Repository about Islam, its important basics, teachings etc.
CSS
1
star
26

jiga

Google App Engine Project
PHP
1
star
27

DeepLabV2-ResNet101-TensorFlow

DeepLabV2-ResNet101 implementation in TensorFlow and python 3
Python
1
star
28

AWS-DeepRacer

AWS DeepRacer reward functions, based on 2022 competitions
Python
1
star
29

Math-Project

A mathematical calculation based site
JavaScript
1
star
30

Grow-Healthy

Solution app made for Microsoft Imagine Cup 2013 Competition
C#
1
star
31

UNet-PyTorch

U-Net implemented with PyTorch
C++
1
star
32

LIP-SSL-Caffe

Caffe implementation of LIP-SSL
Jupyter Notebook
1
star