File size: 2,123 Bytes
de7aa32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---

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])

```