--- license: cc-by-nc-sa-4.0 extra_gated_prompt: You agree that this data will only be used for non-commercial purposes. extra_gated_fields: Name: text Email: text Country: country Organization or Affiliation: text I agree to use this dataset for non-commercial use ONLY: checkbox --- # Complex Virtual Dressing Dataset (CVDD) This dataset contains 516 pairs of virtual try-on test data in complex scenarios, as proposed in the paper ["FitDiT: Advancing the Authentic Garment Details for High-fidelity Virtual Try-on"](https://arxiv.org/abs/2411.10499). The images in this dataset have varying resolutions. To ensure consistent testing under the same resolution, you can use the following code: ``` from PIL import Image import math def pad_and_resize(im, new_width=768, new_height=1024, pad_color=(255, 255, 255), mode=Image.LANCZOS): old_width, old_height = im.size ratio_w = new_width / old_width ratio_h = new_height / old_height if ratio_w < ratio_h: new_size = (new_width, round(old_height * ratio_w)) else: new_size = (round(old_width * ratio_h), new_height) im_resized = im.resize(new_size, mode) pad_w = math.ceil((new_width - im_resized.width) / 2) pad_h = math.ceil((new_height - im_resized.height) / 2) new_im = Image.new('RGB', (new_width, new_height), pad_color) new_im.paste(im_resized, (pad_w, pad_h)) return new_im, pad_w, pad_h def unpad_and_resize(padded_im, pad_w, pad_h, original_width, original_height): width, height = padded_im.size left = pad_w top = pad_h right = width - pad_w bottom = height - pad_h cropped_im = padded_im.crop((left, top, right, bottom)) resized_im = cropped_im.resize((original_width, original_height), Image.LANCZOS) return resized_im # resize image to same resolution(e.g., 768x1024) image_size = image.size image, pad_w, pad_h = pad_and_resize(image, 768, 1024) # convert back to original size image = unpad_and_resize(image, pad_w, pad_h, image_size[0], image_size[1]) ```