JDAI-CV / Down-to-the-Last-Detail-Virtual-Try-on-with-Detail-Carving

Virtural try-on under arbitrary poses
MIT License
217 stars 65 forks source link

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

Open vigyanik opened 3 years ago

vigyanik commented 3 years ago

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.
trilokpadhi commented 3 years ago

hey can you try changing that line to x = x.contiguous().view(x.size(0), -1)

it worked for me Thanks

sanazsab commented 3 years ago

hey can you try changing that line to x = x.contiguous().view(x.size(0), -1)

it worked for me Thanks

It also works for me.