minar09 / cp-vton-plus

Official implementation for "CP-VTON+: Clothing Shape and Texture Preserving Image-Based Virtual Try-On", CVPRW 2020
https://minar09.github.io/cpvtonplus/
MIT License
352 stars 121 forks source link

Error in test #61

Open piggybox opened 3 years ago

piggybox commented 3 years ago

I followed the steps in the readme and ran the test in command line as

python test.py --name GMM --stage GMM --workers 1 --datamode test --data_list test_pairs.txt --checkpoint checkpoints/GMM/gmm_final.pth

and got this error


Original Traceback (most recent call last):
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\Projects\cp-vton-plus\cp_dataset.py", line 138, in __getitem__
    shape_ori = self.transform(parse_shape_ori)  # [-1,1]
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 67, in __call__
    img = t(img)
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 226, in forward
    return F.normalize(tensor, self.mean, self.std, self.inplace)
  File "C:\Users\piggybox\Anaconda3\lib\site-packages\torchvision\transforms\functional.py", line 284, in normalize
    tensor.sub_(mean).div_(std)
RuntimeError: output with shape [1, 256, 192] doesn't match the broadcast shape [3, 256, 192]```

Any one shed a light on this?
TidamCo commented 3 years ago

You probably have a greyscale image as an input, and the model is expecting RGB.

(RGB has a shape of 3, while greyscale has a shape of 1)

qijindao commented 3 years ago

Do you have solved the problem? I am meeting the same problem and I don't know how to solve it.

thaithanhtuan commented 2 years ago

Do you have solved the problem? I am meeting the same problem, and I don't know how to solve it.

As @TidamCo said, the input image should be in RGB color (3 channels). Can you simply convert the input image into color or change the code so that it can transform a single channel image as done with a clothing mask?