Paul commited on
Upload processor
Browse files- image_processing_swin.py +2 -1
image_processing_swin.py
CHANGED
|
@@ -30,9 +30,10 @@ class MyCustomSwinProcessor(ViTImageProcessor):
|
|
| 30 |
bottom = pad_h - top
|
| 31 |
|
| 32 |
# Pad with white because its the dataset default background color
|
| 33 |
-
return transforms.functional.pad(image, (left, top, right, bottom), fill=255)
|
| 34 |
|
| 35 |
def preprocess(self, images, **kwargs):
|
| 36 |
images = [self.resize_and_pad(image, target_size=224) for image in images]
|
|
|
|
| 37 |
images = torch.stack(images)
|
| 38 |
return super().preprocess(images, **kwargs)
|
|
|
|
| 30 |
bottom = pad_h - top
|
| 31 |
|
| 32 |
# Pad with white because its the dataset default background color
|
| 33 |
+
return transforms.functional.pad(image, (left, top, right, bottom), fill=255)
|
| 34 |
|
| 35 |
def preprocess(self, images, **kwargs):
|
| 36 |
images = [self.resize_and_pad(image, target_size=224) for image in images]
|
| 37 |
+
images = [transforms.ToTensor()(image) for image in images]
|
| 38 |
images = torch.stack(images)
|
| 39 |
return super().preprocess(images, **kwargs)
|