Code Monkey home page Code Monkey logo

down-to-the-last-detail-virtual-try-on-with-detail-carving's Introduction

Down to the Last Detail: Virtual Try-on with Detail Carving

Code for virtual try-on with high-fidelity details. The code was developed and tested with Pytorch0.4.1.

Virtual try-on results

Getting Started

Installation

  • Clone this repo
git clone https://github.com/AIprogrammer/Detailed-virtual-try-on.git. 
cd Detailed-virtual-try-on
  • Download our pretrained models from Google Drive, and put them in "./pretrained_checkpoint".

Demo

  • We provide a demo model, as well as some samples in "./dataset/images". Triplets including source image, target pose, target cloth is provided in the "./demo/demo.txt".
  • Quick testing and checking results in "./demo/forward/0.jpg" by running
sh demo.sh

Training

Download the dataset

  • Download the MPV dataset from Image-based Multi-pose Virtual Try On and put the dataset under "./dataset/images/".
  • Select postive perspective images, create dataset split file 'data_pair.txt', and put it under "./dataset/".

Dataset preprocessing

  • Pose keypoints. Use the Openpose, and put the keypoints file in "./dataset/pose_coco".
  • Semantic parsing. Use the CIHP_PGN, and put the parsing results in "./dataset/parse_cihp".
  • Cloth mask. Use the "GrabCut" method for the cloth mask, and put the mask in "./dataset/cloth_mask".

Coarse-to-fine training

  • Download the VGG19 pretrained checkpoint
cd vgg_model/
wget https://download.pytorch.org/models/vgg19-dcbb9e9d.pth
  • Set different configuration based on the "config.py". Then run
sh train.sh

Related Publications

If you find this code helpful, please cite our paper:

@inproceedings{detail2019,
  title={Down to the Last Detail: Virtual Try-on with Detail Carving},
  author={Wang, Jiahang and Zhang, Wei and Liu, Weizhong and Mei, Tao},
  booktitle = {arXiv:1912.06324},
  year={2019}
}

@inproceedings{cvpr19,
  title={Unsupervised Person Image Generation with Semantic Parsing Transformation},
  author={Song, Sijie and Zhang, Wei and Liu, Jiaying and Mei, Tao},
  booktitle = {CVPR},
  year={2019}
}

@inproceedings{pami20,
  title={Unpaired Person Image Generation with Semantic Parsing Transformation},
  author={Song, Sijie and Zhang, Wei and Liu, Jiaying and Guo, Zongming and Mei, Tao},
  booktitle = {IEEE Trans. on PAMI},
  year={2020}
}

down-to-the-last-detail-virtual-try-on-with-detail-carving's People

Contributors

aiprogrammer avatar sandcu225 avatar wzhang34 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

down-to-the-last-detail-virtual-try-on-with-detail-carving's Issues

An error about the demo.sh

While run the demo.sh, error msg is here:

Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=16, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='end2end', gan_mode='lsgan', gpu_ids=[0], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=1, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
initialization method [normal]
initialization method [normal]
initialize network with normal
initialize network with normal
initialize network with normal
====================
====================
====================
====================
==>loaded model
Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-692ce522c4fa>", line 1, in <module>
    runfile('E:/Code/Python/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/demo.py', wdir='E:/Code/Python/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving')
  File "D:\Program Files\JetBrains\PyCharm 2020.3.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "D:\Program Files\JetBrains\PyCharm 2020.3.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "E:/Code/Python/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/demo.py", line 176, in <module>
    forward(opt, paths, 4, opt.forward_save_path)
  File "E:/Code/Python/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/demo.py", line 96, in forward
    for i, result in enumerate(val_dataloader):
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\utils\data\dataloader.py", line 337, in __next__
    return self._process_next_batch(batch)
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\utils\data\dataloader.py", line 359, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\utils\data\dataloader.py", line 106, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\utils\data\dataloader.py", line 106, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "E:\Code\Python\Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving\data\demo_dataset.py", line 87, in __getitem__
    source_parse_shape = self.transforms['1'](source_parse_shape) # [-1,1]
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torchvision\transforms\transforms.py", line 61, in __call__
    img = t(img)
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torchvision\transforms\transforms.py", line 166, in __call__
    return F.normalize(tensor, self.mean, self.std, self.inplace)
  File "D:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torchvision\transforms\functional.py", line 217, in normalize
    tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

Face

Is it only results women face?

installation requirements?

There is not data on how to install this. not even a requirements.txt

Some info regarding this would be great?

Thanks

Cuda Memory Error

I am getting this error
RuntimeError: CUDA out of memory. Tried to allocate 648.00 MiB (GPU 0; 3.82 GiB total capacity; 1.57 GiB already allocated; 665.06 MiB free; 1.98 GiB reserved in total by PyTorch)

My hardware is Geforce GTX1650 4GB dedicated memory
I tried this on google colab too.

I already tried :
Batch size from 128 to 2
Cleared GPU cache.

I think it need to be fixed from code. Some variables unnecessarily taking too much space. Please help me.
Thanks in advance

RuntimeError: CUDA out of memory while training

Hi! Can you please tell me what hardware configuration are you using for training?
Especially for Step 4 and Step 5:

### Step 4: Train Face Refinement
python train.py --train_mode face
### Step 5: Train jointly
# python train.py --train_mode appearance --joint_all --joint_parse_loss

Currently, I am using 8 K80s but still getting CUDA out of memory while training.
Thanks!

Face refinement not natural

Are there any options for face refinement other than the default. Faces are not as refined as they should be.

Error while running demo.sh "_pickle.UnpicklingError: invalid load key, '\xff'

Hi all,

There is an error shows up when running demo.sh. "_pickle.UnpicklingError: invalid load key, '\xff'."
Is anyone encountering the same error?

thank you !

Running forward

  • CUDA_VISIBLE_DEVICES=1 python3 demo.py --batch_size_v 80 --num_workers 4 --for ward_save_path demo/forward
    Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5 , dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=2 00, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine _height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type= 'normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G _app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, jo int=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1 =1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, ne tD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_ap p='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_drop out=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, ou tput_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face ='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_f ace='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/pars ing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing ', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
    initialization method [normal]
    initialization method [normal]
    initialize network with normal
    initialize network with normal
    initialize network with normal
    Traceback (most recent call last):
    File "demo.py", line 184, in
    forward(opt, paths, 4, opt.forward_save_path)
    File "demo.py", line 69, in forward
    load_model(model, path)
    File "demo.py", line 37, in load_model
    checkpoint = torch.load(path)
    File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 529 , in load
    return legacy_load(opened_file, map_location, pickle_module, **pickle_load args)
    File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 692 , in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
    _pickle.UnpicklingError: invalid load key, '\xff'.

demo.py is not picking up valid images

FileNotFoundError: [Errno 2] No such file or directory: 'dataset/images/train/TW421D05Y/TW421D05Y-C11@9=person_whole_front.jpg'

demo.py is picking up valid option to demo images , according to my analysis opt.warp_cloth = false.

Here is the Screen shot of attached error
image

image

index error at pose_utils.py save_image function on my own dataset

started training on my own dataset. Faced a size mismatch error while concatenating in the function save_image. The cloth parse png image is given 2 additional channels as it has 1 channel in the start in format (batchsize,1,256,192) => (batchsize,3,256,192)
But it does not shift the channel to the end as required by the pytorch models. Hence concatenation error occures when there is a size mismatch, example concat([batchsize,256,192,3],[batchsize,3,256,192])

I did add a permute statement by myself but the error should not have occured in the first place.

Code sample:

all parsing_vis and mask can not use tensor type

def save_img(images, path):
img = []
assert len(images) > 0

for i in range(len(images)):
    
    if isinstance(images[i], np.ndarray):
        if images[i].shape[3] == 1:
            images[i] = images[i].repeat(3, axis=3)
        elif images[i].shape[3] != 3:
            images[i] = images[i].transpose((0,2,3,1))
    else:
        if images[i].shape[1] == 1:
            images[i] = images[i].repeat(1,3,1,1)
            **#line changed below**
            **images[i] = images[i].permute(0,2,3,1).cpu().numpy()**
        elif images[i].shape[1] == 3:
            images[i] = ((images[i].permute(0,2,3,1).contiguous().cpu().numpy() * 0.5 + 0.5) * 255).astype(np.uint8)
        else:
            images[i] = images[i].cpu().numpy()
for i in range(len(images[0])):
    img.append(np.concatenate([image[i] for image in images], axis=1))

img = np.concatenate(img, axis=0)

image = Image.fromarray(img.astype(np.uint8))
image.save(path)

Dataset download fail

Hello, Thank you for your great work
I tried to download the dataset, but I couldn't connect to the link of dataset MPV

Error In Demo.py

in demo.py Line number 22 is
from lib.geometric_matching import GMM

but there is no module called geometric_matching in lib folder.

IndexError while running demo.sh

/content/drive/My Drive/Eroom-models-working/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving
Running forward

  • CUDA_VISIBLE_DEVICES=0 python demo.py --batch_size_v 80 --num_workers 4 --forward_save_path demo/forward
    Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
    initialization method [normal]
    initialization method [normal]
    initialize network with normal
    initialize network with normal
    initialize network with normal
    ====================
    ====================
    ====================
    ====================
    ==>loaded model
    Traceback (most recent call last):
    File "demo.py", line 184, in
    forward(opt, paths, 4, opt.forward_save_path)
    File "demo.py", line 106, in forward
    for i, result in enumerate(val_dataloader):
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 363, in next
    data = self._next_data()
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 989, in _next_data
    return self._process_data(data)
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1014, in _process_data
    data.reraise()
    File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 395, in reraise
    raise self.exc_type(msg)
    IndexError: Caught IndexError in DataLoader worker process 0.
    Original Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop
    data = fetcher.fetch(index)
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
    File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
    data = [self.dataset[idx] for idx in possibly_batched_index]
    File "/content/drive/My Drive/Eroom-models-working/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/data/demo_dataset.py", line 123, in getitem
    target_pose_img, _ = pose_utils.draw_pose_from_cords(target_pose_loc, (256, 192))
    File "/content/drive/My Drive/Eroom-models-working/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/utils/pose_utils.py", line 113, in draw_pose_from_cords
    colors[yy, xx] = COLORS[i]
    IndexError: list index out of range

Not able to run demo

==>loaded model
Traceback (most recent call last):
File "demo.py", line 184, in
forward(opt, paths, 4, opt.forward_save_path)
File "demo.py", line 108, in forward
warped_cloth = warped_image(gmm, result)
File "/content/drive/My Drive/Detailed-virtual-try-on/utils/warp_image.py", line 29, in warped_image
grid, theta = model(agnostic, cloth_image)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/parallel/data_parallel.py", line 153, in forward
return self.module(*inputs[0], **kwargs[0])
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/content/drive/My Drive/Detailed-virtual-try-on/lib/geometric_matching_multi_gpu.py", line 430, in forward
theta = self.regression(correlation)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/content/drive/My Drive/Detailed-virtual-try-on/lib/geometric_matching_multi_gpu.py", line 126, in forward
x = x.view(x.size(0), -1)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Dataset Processing

Hi @AIprogrammer @wzhang34 @sandcu225 ,
Thanks for your impressive work. I want to follow you step to conduct further experiments. However, when I download the MPV dataset from this link https://competitions.codalab.org/competitions/23471. It is hard for me to reorganize the dataset like the kind used in your paper. Could you please provide us further guidance on how to process the dataset step by step? Or could you please share the already processed data with us?

I am looking forward to your reply~
Thanks very much~

demo.sh not working RuntimeError: unexpected EOF. The file might be corrupted.

Hello,

I am trying to run the demo.sh file and I downloaded the checkpoints directly from GDrive. Unfortunately, it is telling me that the file might be corrupted.

Have you ever encountered this issue? How do I fix this?

Traceback (most recent call last):
  File "demo.py", line 184, in <module>
    forward(opt, paths, 4, opt.forward_save_path)
  File "demo.py", line 69, in forward
    load_model(model, path)    
  File "demo.py", line 37, in load_model
    checkpoint = torch.load(path)
  File "/home/gaurav/.miniconda3/lib/python3.7/site-packages/torch/serialization.py", line 358, in load
    return _load(f, map_location, pickle_module)
  File "/home/gaurav/.miniconda3/lib/python3.7/site-packages/torch/serialization.py", line 549, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF. The file might be corrupted.

GMM training result after 200 epoch looks worse than the pretrain model

I add some new cloth and do training step 1 (using your provided data pairs dataset/data_pair.txt) with the following cmd: python train.py --train_mode gmm .
After 200 epochs, I used generated model at the path below: net_model/gmm_checkpoint/generator/checkpoint_G_epoch_199.tar as input value for "--resume_gmm" option when run demo.py.
I got the following result:
200 epoch
(The bottom 2 rows are for the new clothes I added)
The red circled area has different results than the pretrain model

So I have some questions:

  1. This is right way to use new-train GMM model?
  2. Which train options should I use to re-produce the result as mentioned in the paper?
  3. How many epochs did you run on each training step (GMM, Parsing, Appearance) ?
  4. Did I have any mistake on GMM training?

Error in training Step 1:

I got this error when run command python train.py --train_mode gmm

Traceback (most recent call last):
  File "train.py", line 79, in <module>
    train(opt)
  File "train.py", line 75, in train
    model.save_model(opt, epoch)
  File "/home/thotd/Documents/VirtualTryOn/Virtual-Try-on-with-Detail-Carving/models/generation_model.py", line 370, in save_model
    model_G = osp.join(self.save_dir, 'generator', 'checkpoint_G_epoch_%d_loss_%0.5f_pth.tar'%(epoch, self.loss_G))
AttributeError: 'GenerationModel' object has no attribute 'loss_G'

When change line 370 to
model_G = osp.join(self.save_dir, 'generator', 'checkpoint_G_epoch_%d_pth.tar'%(epoch)
it is possible pass this error and generate model, but will it affect the use of this model later?

Error during running of demo.sh

I am encountering an error "No such file or directory: 'dataset/images/train/TW421D05Y/TW421D05Y-C11@9=person_whole_front.jpg' " during running of demo.sh

Here is full error msg :

Traceback (most recent call last):
File "demo.py", line 185, in
forward(opt, paths, 4, opt.forward_save_path)
File "demo.py", line 107, in forward
for i, result in enumerate(val_dataloader):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 345, in next
data = self._next_data()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 394, in reraise
raise self.exc_type(msg)
FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/gdrive/My Drive/vto/vto/data/demo_dataset.py", line 69, in getitem
source_img = self.open_transform(source_img_path, False)
File "/content/gdrive/My Drive/vto/vto/data/demo_dataset.py", line 172, in open_transform
img = Image.open(path)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2766, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'dataset/images/train/TW421D05Y/TW421D05Y-C11@9=person_whole_front.jpg'

Dataset is not Found

I would like to know where the dataset is available. The link provided doesn't have the dataset available in drive or baidu.
Thank You

minimum gpu required

hey, i am having a nvidia gpu gtx 1050 which comes with 4gb of memory. would it be sufficient to train the model or does it throw a memory allocation error?

Bad Results on different pose and background.

Hello @wzhang34 @wyvernbai @L1aoXingyu @sandcu225 @Chen94yue @AIprogrammer
Model gives bad results when we used different pose and background on custom images.
Here is some issue that I faced :

  1. Source image : Different background with simple human pose
    Target Image : Woman cloth type(sleeveless top)
    Result Image : This cloth is looks like cloth over the t-shirt
  2. Source image : Different background with simple human pose
    Target Image : Woman cloth type(Jacket)
    Result Image : No doubt Jacket is fit on that girl but bad result on lower body cloth(it seems like pants)
  3. Source image : Different background with complex human pose
    Target Image : Woman cloth type(sleeveless top)
    Result Image : Model didn't give good result on pose keypoints, geometric matching module(gmm), semantic parsing and final result.
  4. Source image : Different background with complex human pose
    Target Image : Woman cloth type(sleeveless top)
    Result Image : Model didn't give good result on pose keypoints, geometric matching module(gmm), semantic parsing and final result.

**Please give me a suggestion what should i do ? **
Screenshot from 2020-07-21 11-41-59

Error while running demo.sh "view size is not compatible with input tensor's size and stride"

I'm running into the following error while running demo.sh

==

Running forward
+ CUDA_VISIBLE_DEVICES=0 python demo.py --batch_size_v 80 --num_workers 4 --forward_save_path demo/forward
Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
initialization method [normal]
initialization method [normal]
initialize network with normal
initialize network with normal
initialize network with normal
====================
====================
====================
====================
==>loaded model
/home/yash/projects/Detailed-virtual-try-on/utils/pose_utils.py:112: FutureWarning: `draw.circle` is deprecated in favor of `draw.disk`.`draw.circle` will be removed in version 0.19
  yy, xx = circle(joint[0], joint[1], radius=radius, shape=img_size)
Traceback (most recent call last):
  File "demo.py", line 184, in <module>
    forward(opt, paths, 4, opt.forward_save_path)
  File "demo.py", line 108, in forward
    warped_cloth = warped_image(gmm, result) 
  File "/home/yash/projects/Detailed-virtual-try-on/utils/warp_image.py", line 29, in warped_image
    grid, theta = model(agnostic, cloth_image)
  File "/home/yash/venvs/dl/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yash/venvs/dl/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/yash/venvs/dl/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yash/projects/Detailed-virtual-try-on/lib/geometric_matching_multi_gpu.py", line 430, in forward
    theta = self.regression(correlation)
  File "/home/yash/venvs/dl/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yash/projects/Detailed-virtual-try-on/lib/geometric_matching_multi_gpu.py", line 126, in forward
    x = x.view(x.size(0), -1)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

"GrabCut"

"GrabCut" can not be used to generate the edge of color, can you tell me why ?

view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

When I run demo.sh script I get the following error. Will you please help me out?

==>loaded model Traceback (most recent call last): File "demo.py", line 184, in <module> forward(opt, paths, 4, opt.forward_save_path) File "demo.py", line 108, in forward warped_cloth = warped_image(gmm, result) File "/content/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/utils/warp_image.py", line 29, in warped_image grid, theta = model(agnostic, cloth_image) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.6/dist-packages/torch/nn/parallel/data_parallel.py", line 153, in forward return self.module(*inputs[0], **kwargs[0]) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/content/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/lib/geometric_matching_multi_gpu.py", line 430, in forward theta = self.regression(correlation) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/content/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/lib/geometric_matching_multi_gpu.py", line 126, in forward x = x.view(x.size(0), -1) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

list index out of range

Hi evereybody,
I have the issue regarding

line 135, in getitem
source_pose = a['people'][0]['pose_keypoints_2d']
IndexError: list index out of range.

How could I fix it?

Thanks

Issues running demo.sh

Getting error
ImportError: cannot import name 'data' from 'utils' (unknown location)
when running demo.sh file

Question about total variation regularization and training strategy of appearance generative network

Thanks for this great work, however, I still have some questions about training strategy and loss term.

The training code of appearance generative network in train.sh is as below:

python train.py --train_mode appearance --batch_size_t 16 --save_time --suffix refactor --val_freq 20 --save_epoch_freq 1 --joint_all --joint_parse_loss

  1. This command uses --joint_parse_loss option instead of --mask_tvloss, and total variation regularization term in Equation 5 is not optimized.
  2. This command directly uses --joint_all option, which should be only used after the training of the face refinement network.

demo.py erros on custom image

Could anyone please tell where could be the error. I updated the json to coco format. So I am pretty sure, that there isn't any error wrt json file. All images are of size (256,192,3). I don't understand why it is showing size as [1,256,192,3]. I have rechecked the sizes of all images, it works fine if it's just their inference data, but fails with my dataset.

First 4 examples in demo.txt are the inference samples, and the last is my custom sample.

1LJ21D005-G11@10=person_half_front.jpg AD121D0G7-A11@10=person_half_front_keypoints.json CO121D08G-O11@10=cloth_front.jpg test
1VJ21D02K-Q11@8=person_half_front.jpg AD121D0F0-G12@10=person_half_front_keypoints.json AD121D0HY-Q11@18=cloth_front.jpg test
4HI21D003-C11@10=person_half_front.jpg EV421EA51-A11@9=person_whole_front_keypoints.json [email protected]=cloth_front.jpg test
A0F21D012-K11@8=person_half_front.jpg EV421DAIY-E11@8=person_half_front_keypoints.json [email protected]=cloth_front.jpg test
10resized.jpg 10resized_keypoints.json s-1resized.jpg test
Running forward
+ CUDA_VISIBLE_DEVICES=0 python demo.py --batch_size_v 80 --num_workers 4 --forward_save_path demo/forward
Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
initialization method [normal]
initialization method [normal]
initialize network with normal
initialize network with normal
initialize network with normal
====================
====================
====================
====================
==>loaded model
Traceback (most recent call last):
  File "demo.py", line 184, in <module>
    forward(opt, paths, 4, opt.forward_save_path)
  File "demo.py", line 106, in forward
    for i, result in enumerate(val_dataloader):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 435, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
    return self._process_data(data)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
    data.reraise()
  File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 428, in reraise
    raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/collate.py", line 73, in default_collate
    return {key: default_collate([d[key] for d in batch]) for key in elem}
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/collate.py", line 73, in <dictcomp>
    return {key: default_collate([d[key] for d in batch]) for key in elem}
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/collate.py", line 55, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: stack expects each tensor to be equal size, but got [1, 256, 192] at entry 0 and [1, 256, 192, 3] at entry 4

I don't understand why it is showing it this why with my custom image.

colab demo?

Hello, Thank you for your great work
It will be very helpful for everyone if you kindly provide a colab notebook demo for this amazing repo
It will resolve many issues and everyone can easily test it
Thank you, Looking forward to the demo

Can't extract pretrained models

Hi,
We tried to extract the pretrained models from googledrive but when we are going to open them in both linux and windows, they appear to be corrupted.

Replace geometric_matching.py by geometric_matching_multi_gpu.py

In train.py require lib.geometric_matching import GMM, but in lib directory have only geometric_matching_multi_gpu.py, so I rename this file to geometric_matching.py and start training on machine with 1 gpu only without error .
Is that the right way to go?

Error While running demo.sh file

Hi,

I have completed all the steps but at last it revert back with this error

Running forward

  • CUDA_VISIBLE_DEVICES=0 python demo.py --batch_size_v 80 --num_workers 4 --forward_save_path demo/forward
    Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
    initialization method [normal]
    initialization method [normal]
    Traceback (most recent call last):
    File "demo.py", line 184, in
    forward(opt, paths, 4, opt.forward_save_path)
    File "demo.py", line 54, in forward
    gmm = GMM(opt)
    File "/content/drive/My Drive/Ayush Gupta/FASHION TRANSFER/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/lib/geometric_matching_multi_gpu.py", line 421, in init
    self.gridGen = TpsGridGen(opt.fine_height, opt.fine_width, use_cuda=True, grid_size=opt.grid_size)
    File "/content/drive/My Drive/Ayush Gupta/FASHION TRANSFER/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/lib/geometric_matching_multi_gpu.py", line 159, in init
    self.grid_X = self.grid_X.cuda()
    File "/usr/local/lib/python3.6/dist-packages/torch/cuda/init.py", line 149, in _lazy_init
    _check_driver()
    File "/usr/local/lib/python3.6/dist-packages/torch/cuda/init.py", line 63, in _check_driver
    of the CUDA driver.""".format(str(torch._C._cuda_getDriverVersion())))
    AssertionError:
    The NVIDIA driver on your system is too old (found version 10010).
    Please update your GPU driver by downloading and installing a new
    version from the URL: http://www.nvidia.com/Download/index.aspx
    Alternatively, go to: https://pytorch.org to install
    a PyTorch version that has been compiled with your version
    of the CUDA driver.

how to test on new images

I have a person's image wearing a top. This is my reference image. Also, I have the segmentation map of the reference image. I take one more image which
is my target image. And I have created 18 points key points from the open pose of the target image. Now I have an in-shop clothe(top), whose binary mask I have calculated using OpenCV. I need to wrap this clothe on the target image(whose key points I have generated). Haven't read the full paper yet

  1. What all things I need to generate to test on my own data?
  2. Do I need to resize all the images to 256x192 before feeding it to the network
  3. in the demo_txt file I am using the below format
    reference image.jpg target_pose_keypoints.json clothe_item.jpg

and I am getting below error while running demo.sh. I ran the demo.sh with the example settings and it generated images. So the code is working. The only thing is I am not able to test for my own images.

Thanks in advance

Traceback (most recent call last):
File "demo.py", line 185, in
forward(opt, paths, 4, opt.forward_save_path)
File "demo.py", line 109, in forward
warped_cloth = warped_image(gmm, result)
File "/media/trinanjan/BACKUP/Trinanjan/current_project/virtual_try_on/Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving/utils/warp_image.py", line 28, in warped_image
agnostic = torch.cat([source_parse_shape, im_h, target_pose_embedding], 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 256 and 1100 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:87

I have some problems when running demo.sh

  1. I have downloaded the dataset and split the dataset as train/test folder. But there are many folders without label in all.rar and many duplicate samples in the txt, so i just got 1417 folers in test folder, and 6443 folders in train folder. I dont know is it the right way to process the data. Would u mind introducing how to process the original data and giving the numbers of the train datas and test datas?

  2. When I use the data that I have split to run the demo.sh, I got a error as follow:
    Traceback (most recent call last):
    File "demo.py", line 185, in
    forward(opt, paths, 4, opt.forward_save_path)
    File "demo.py", line 107, in forward
    for i, result in enumerate(val_dataloader):
    File "D:\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 346, in next
    data = self.dataset_fetcher.fetch(index) # may raise StopIteration
    File "D:\anaconda\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
    File "D:\anaconda\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
    data = [self.dataset[idx] for idx in possibly_batched_index]
    File "E:\MPV_Dataset\Detailed-virtual-try-on\data\demo_dataset.py", line 74, in getitem
    source_splitext = os.path.join(source_splitext.split('/')[0], source_splitext.split('/')[2])
    IndexError: list index out of range

Then I make opt.warp_cloth False , I got another error:
Traceback (most recent call last):
File "demo.py", line 185, in
forward(opt, paths, 4, opt.forward_save_path)
File "demo.py", line 107, in forward
for i, result in enumerate(val_dataloader):
File "D:\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 346, in next
data = self.dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\anaconda\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\anaconda\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "E:\MPV_Dataset\Detailed-virtual-try-on\data\demo_dataset.py", line 86, in getitem
source_parse_shape = self.transforms'1' # [-1,1]
File "D:\anaconda\lib\site-packages\torchvision\transforms\transforms.py", line 61, in call
img = t(img)
File "D:\anaconda\lib\site-packages\torchvision\transforms\transforms.py", line 166, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "D:\anaconda\lib\site-packages\torchvision\transforms\functional.py", line 217, in normalize
tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
IndexError: too many indices for tensor of dimension 0

Would u mind giving some suggestions to me to solve it ?
Thanks.

[error while run train.sh] RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

error while run train.sh, error message as follow:
is anybody know how to solve it ??

thank you !

Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=16, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='end2end', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=16, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='face', use_gmm=False, val_freq=200, warp_cloth=False, weight_decay=0.0001)
initialization method [normal]
initialization method [normal]
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
loading...
loading...
loading...
loading...
the length of dataset is 1
current G learning_rate is : 0.0002
current D learning_rate is : 0.0002
source_parse_vis_path: dataset/parse_cihp/train/0VB21E007-T11@9=person_whole_front_vis.png
target_parse_vis_path: dataset/parse_cihp/train/0VB21E007-T11@8=person_half_front_vis.png
(256, 192)


<PIL.Image.Image image mode=L size=192x256 at 0x7F6E05C73518>
Traceback (most recent call last):
File "train.py", line 82, in
train(opt)
File "train.py", line 67, in train
for i, data in enumerate(dataloader):
File "/home/spencerhu/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in next
return self._process_next_batch(batch)
File "/home/spencerhu/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 357, in process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/spencerhu/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/spencerhu/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/nfs/user/spencerhu/PycharmProjects/virtualtryon/data/regular_dataset.py", line 119, in getitem
source_parse_shape = self.transforms'1' # [-1,1]
File "/home/spencerhu/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 60, in call
img = t(img)
File "/home/spencerhu/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 163, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/spencerhu/.local/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 208, in normalize
tensor.sub
(mean[:, None, None]).div
(std[:, None, None])
RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

About MPV dataset and VTON dataset

When I got these two datasets,I found that some of the pictures are the same.So I was wondering are they the same?Or just part of the picture in MPV are same as the VTON dataset?

Error While Prining the Filnal outout in demo.py

TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

This coming from File "/content/vton/utils/pose_utils.py", line 154, in save_img
img.append(np.concatenate([image[i] for image in images], axis=1))

Here is the complete log

Running forward

  • CUDA_VISIBLE_DEVICES=0 python demo.py --batch_size_v 80 --num_workers 4 --forward_save_path demo/forward
    Namespace(G_GAN=1, G_VGG=1, G_nn=1, batch_size_t=128, batch_size_v=80, beta1=0.5, dataroot=False, dataset='MPV', dataset_mode='regular', decay_iters=10, epoch=200, face_L1=10, face_gan=3, face_img_L1=1, face_residual=False, face_vgg=1, fine_height=256, fine_width=192, forward='normal', forward_save_path='demo/forward', gan_mode='lsgan', gpu_ids=[0, 1, 2, 3], grid_size=5, init_gain=0.02, init_type='normal', input_nc_D_app=6, input_nc_D_face=6, input_nc_D_parsing=56, input_nc_G_app=26, input_nc_G_face=6, input_nc_G_parsing=36, isdemo=False, isval=False, joint=False, joint_G_parsing=1, joint_all=False, joint_parse_loss=False, lambda_L1=1, lr=0.0002, mask=1, mask_tvloss=False, momentum=0.9, n_layers_D=3, ndf=64, netD_app='resnet_blocks', netD_face='resnet_blocks', netD_parsing='basic', netG_app='treeresnet', netG_face='treeresnet', netG_parsing='unet_256', ngf=64, no_dropout=False, norm='instance', num_workers=4, output_nc_app=4, output_nc_face=3, output_nc_parsing=20, pool_size=100, print_freq=10, resume_D_app='', resume_D_face='', resume_D_parse='', resume_G_app='pretrained_checkpoint/app.tar', resume_G_face='pretrained_checkpoint/face.tar', resume_G_parse='pretrained_checkpoint/parsing.tar', resume_gmm='pretrained_checkpoint/step_009000.pth', save_epoch_freq=1, save_time=False, size=(256, 192), start_epoch=0, suffix='', train_mode='parsing', use_gmm=False, val_freq=200, warp_cloth=True, weight_decay=0.0001)
    initialization method [normal]
    initialization method [normal]
    initialize network with normal
    initialize network with normal
    initialize network with normal
    ====================
    ====================
    ====================
    ====================
    ==>loaded model
    /usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:1339: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
    warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
    /usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:1350: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
    warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
    Traceback (most recent call last):
    File "demo.py", line 202, in
    forward(opt, paths, 4, opt.forward_save_path)
    File "demo.py", line 186, in forward
    refine_path, '%d.jpg') % (i))
    File "/content/vton/utils/pose_utils.py", line 154, in save_img
    img.append(np.concatenate([image[i] for image in images], axis=1))
    File "<array_function internals>", line 6, in concatenate
    File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 412, in array
    return self.numpy()
    TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.