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
346 stars 120 forks source link

custom image error #40

Closed ikenaga530 closed 3 years ago

ikenaga530 commented 3 years ago

I'm going to try cp-vton-plus with custom images

In dataset_neck_skin_correction.py, only custom images get the following error

Traceback (most recent call last): File "dataset_neck_skin_correction.py", line 258, in main() File "dataset_neck_skin_correction.py", line 254, in main image_dir, seg_dir, each[0], mask, updated_seg_dir)# def update_image_segmentation(data_dir, mask_dir, image_name, mask_name, save_dir=None, save_vis=True): File "dataset_neck_skin_correction.py", line 184, in update_image_segmentation result = segmentation + neck_mask ValueError: operands could not be broadcast together with shapes (256,192,3) (256,192)

The dataset image succeeds, the custom image gives me this error. Do you know the cause?

ikenaga530 commented 3 years ago

The custom image had a bit depth of 24 while the image in the dataset had a bit depth of 8.Image-parse generated using LIP_JPPNet. So, I changed the bit depth to 8 and ran dataset_neck_skin_connection.py and it did not show any error, but the output result was different

image 019600_0

image-parse 019600_0

image-parse-new 019600_0

image-parse-new-vis 019600_0_vis

Image-parse is what changed to a bit depth of 8

Why is the cause? Best regards

huangpen commented 3 years ago

Can you show me which line of code needs to be changed in order to generate 8 bit-depth image? Is it like this?

segmentation = Image.open(seg_pth).convert('L')

minar09 commented 3 years ago

When you are using segmentation for training/testing, please use the grayscale file always - image

RGB/colored one is only for visualization, this one is creating much confusion I guess. Also, you don't need to run LIP_JPPNet + dataset_neck_skin_correction.py combination, if you generate segmentation using only CIHP_PGN or Graphonomy (they produce much better results and I suggest using them instead of LIP_JPPNet, also you can use generated segmentation directly for CP-VTON+). Hope that helps. Thanks! @ikenaga530 @huangpen