sergeywong / cp-vton

Reimplemented code for "Toward Characteristic-Preserving Image-based Virtual Try-On Network"
MIT License
474 stars 182 forks source link

The size of tensor a (192) must match the size of tensor b (3) at non-singleton dimension 2 #34

Closed ayush-angelium closed 4 years ago

ayush-angelium commented 4 years ago

Hii @sergeywong , when I tested this model for custom images it gives an error, I have also implemented all the possible solution that mentioned in Issues like :

  1. I used im_h.permute in cp_dataset.py
  2. Installed different torchvision version(0.2.1).
  3. converted rgb to grey image for tensor resize.
  4. used different normalize in cp_dataset.py self.transform = transform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,), (0.5,))])
  5. manually resize in (1,256,192) but still facing tensor size issue.

Here are all possible outcomes that I applied when implementing this model. Please help me to solve this problem. Screenshot from 2020-06-25 20-36-46

greentree20131221 commented 4 years ago

Because your images in image-parse are 24 bit RGB images, and the images in image-parse in dataset are indexed images. You should save the parsed images as indexed color image format or grayscale.

ayush-angelium commented 4 years ago

"Down to the latest detail" is better than cpvton model in terms of accuracy. That's I'm switching this model.

xuCW1 commented 1 year ago

Hii @sergeywong , when I tested this model for custom images it gives an error, I have also implemented all the possible solution that mentioned in Issues like :

  1. I used im_h.permute in cp_dataset.py
  2. Installed different torchvision version(0.2.1).
  3. converted rgb to grey image for tensor resize.
  4. used different normalize in cp_dataset.py self.transform = transform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,), (0.5,))])
  5. manually resize in (1,256,192) but still facing tensor size issue.

Here are all possible outcomes that I applied when implementing this model. Please help me to solve this problem. Screenshot from 2020-06-25 20-36-46

Hello, I also encountered this problem when testing the model for custom images. How did you solve it at last?