@@ -50,13 +50,15 @@ class OwlViTFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin
5050 Args:
5151 do_resize (`bool`, *optional*, defaults to `True`):
5252 Whether to resize the shorter edge of the input to a certain `size`.
53- size (`int`, *optional*, defaults to 768):
54- Resize the shorter edge of the input to the given size. Only has an effect if `do_resize` is set to `True`.
53+ size (`int` or `Tuple[int, int]`, *optional*, defaults to (768, 768)):
54+ The size to use for resizing the image. Only has an effect if `do_resize` is set to `True`. If `size` is a
55+ sequence like (h, w), output size will be matched to this. If `size` is an int, then image will be resized
56+ to (size, size).
5557 resample (`int`, *optional*, defaults to `PIL.Image.BICUBIC`):
5658 An optional resampling filter. This can be one of `PIL.Image.NEAREST`, `PIL.Image.BOX`,
5759 `PIL.Image.BILINEAR`, `PIL.Image.HAMMING`, `PIL.Image.BICUBIC` or `PIL.Image.LANCZOS`. Only has an effect
5860 if `do_resize` is set to `True`.
59- do_center_crop (`bool`, *optional*, defaults to `True `):
61+ do_center_crop (`bool`, *optional*, defaults to `False `):
6062 Whether to crop the input at the center. If the input size is smaller than `crop_size` along any edge, the
6163 image is padded with 0's and then center cropped.
6264 crop_size (`int`, *optional*, defaults to 768):
@@ -74,10 +76,10 @@ class OwlViTFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin
7476 def __init__ (
7577 self ,
7678 do_resize = True ,
77- size = 768 ,
79+ size = ( 768 , 768 ) ,
7880 resample = Image .BICUBIC ,
7981 crop_size = 768 ,
80- do_center_crop = True ,
82+ do_center_crop = False ,
8183 do_normalize = True ,
8284 image_mean = None ,
8385 image_std = None ,
@@ -195,7 +197,7 @@ def __call__(
195197 # transformations (resizing + center cropping + normalization)
196198 if self .do_resize and self .size is not None and self .resample is not None :
197199 images = [
198- self .resize (image = image , size = self .size , resample = self .resample , default_to_square = False )
200+ self .resize (image = image , size = self .size , resample = self .resample , default_to_square = True )
199201 for image in images
200202 ]
201203 if self .do_center_crop and self .crop_size is not None :
0 commit comments