Virtual-Try-On-Flask icon indicating copy to clipboard operation
Virtual-Try-On-Flask copied to clipboard

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 256

Open unlockedlabyoutube opened this issue 4 years ago • 4 comments

RuntimeError Traceback (most recent call last) in 1 start = time.time() ----> 2 result,trusts = model.predict(img, c_img, need_pre=False,check_dirty=True) 3 if result is not None: 4 end = time.time() 5 print("time:"+str(end-start))

C:\Users\Desktop\Virtual-Try-On-Flask-master\Model.py in predict(self, human_img, c_img, need_pre, need_bright, keep_back, need_dilate, check_dirty) 87 (-(16-9))+np.array(parse == 17, dtype='uint8')*(-(17-9)) 88 parse = np.array(parse[:, :, 0], dtype="uint8") ---> 89 (out, warp) = self.cpvton.predict(parse, pose_map, human_img, c_img) 90 91 out_img = np.array((np.transpose(out.detach().cpu().numpy()[

C:\Users\Desktop\Virtual-Try-On-Flask-master\CPVTON.py in predict(self, parse_array, pose_map, human, c) 75 im_h = im * phead - (1 - phead) 76 ---> 77 agnostic = torch.cat([shape, im_h, pose_map], 0) 78 79 if self.use_cuda:

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 256 and 253 in dimension 1 at C:\w\1\s\tmp_conda_3.7_021303\conda\conda-bld\pytorch_1565316900252\work\aten\src\TH/generic/THTensor.cpp:689

unlockedlabyoutube avatar Mar 11 '20 17:03 unlockedlabyoutube

check your torch and torchvision version

GrayXu avatar Mar 12 '20 03:03 GrayXu

import torch print(torch.version) 1.2.0 import torchvision print(torchvision.version) 0.2.0

unlockedlabyoutube avatar Mar 12 '20 07:03 unlockedlabyoutube

can you please specify the pillow,opencv and numpy version

unlockedlabyoutube avatar Mar 12 '20 12:03 unlockedlabyoutube

I got the Same error `--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) in () 1 start = time.time() ----> 2 result,trusts = model.predict(img, c_img, need_pre=False,check_dirty=True) 3 if result is not None: 4 end = time.time() 5 print("time:"+str(end-start))

1 frames /content/Model.py in predict(self, human_img, c_img, need_pre, need_bright, keep_back, need_dilate, check_dirty) 80 (-(16-9))+np.array(parse == 17, dtype='uint8')*(-(17-9)) 81 parse = np.array(parse[:, :, 0], dtype="uint8") ---> 82 (out, warp) = self.cpvton.predict(parse, pose_map, human_img, c_img) 83 84 out_img = np.array((np.transpose(out.detach().cpu().numpy()[

/content/CPVTON.py in predict(self, parse_array, pose_map, human, c) 68 im_h = im * phead - (1 - phead) 69 ---> 70 agnostic = torch.cat([shape, im_h, pose_map], 0) 71 72 if self.use_cuda:

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 1 and 3 in dimension 0 at /pytorch/aten/src/TH/generic/THTensor.cpp:689`

and the version of torch and torchvision are the same as you have mentioned in the README file.

NiksDesai02 avatar Apr 28 '20 00:04 NiksDesai02