Unverified Commit fd0f4695 authored by jiqing-feng's avatar jiqing-feng Committed by GitHub
Browse files

Resize image before crop (#7095)



resize first
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
parent ae84e405
......@@ -546,6 +546,8 @@ class TextualInversionDataset(Dataset):
example["original_size"] = (image.height, image.width)
image = image.resize((self.size, self.size), resample=self.interpolation)
if self.center_crop:
y1 = max(0, int(round((image.height - self.size) / 2.0)))
x1 = max(0, int(round((image.width - self.size) / 2.0)))
......@@ -576,7 +578,6 @@ class TextualInversionDataset(Dataset):
img = np.array(image).astype(np.uint8)
image = Image.fromarray(img)
image = image.resize((self.size, self.size), resample=self.interpolation)
image = self.flip_transform(image)
image = np.array(image).astype(np.uint8)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment