diff --git a/src/transformers/models/efficientnet/image_processing_efficientnet.py b/src/transformers/models/efficientnet/image_processing_efficientnet.py index 2a5b5c93749b..2aff4ae4db83 100644 --- a/src/transformers/models/efficientnet/image_processing_efficientnet.py +++ b/src/transformers/models/efficientnet/image_processing_efficientnet.py @@ -66,7 +66,7 @@ class EfficientNetImageProcessor(BaseImageProcessor): `do_resize` in `preprocess`. size (`dict[str, int]` *optional*, defaults to `{"height": 346, "width": 346}`): Size of the image after `resize`. Can be overridden by `size` in `preprocess`. - resample (`PILImageResampling` filter, *optional*, defaults to 0): + resample (`PILImageResampling` filter, *optional*, defaults to `PIL.Image.BICUBIC`): Resampling filter to use if resizing the image. Can be overridden by `resample` in `preprocess`. do_center_crop (`bool`, *optional*, defaults to `False`): Whether to center crop the image. If the input size is smaller than `crop_size` along any edge, the image @@ -102,7 +102,7 @@ def __init__( self, do_resize: bool = True, size: Optional[dict[str, int]] = None, - resample: PILImageResampling = PIL.Image.NEAREST, + resample: PILImageResampling = PIL.Image.BICUBIC, do_center_crop: bool = False, crop_size: Optional[dict[str, int]] = None, rescale_factor: Union[int, float] = 1 / 255, @@ -113,7 +113,7 @@ def __init__( image_std: Optional[Union[float, list[float]]] = None, include_top: bool = True, **kwargs, - ) -> None: + ): super().__init__(**kwargs) size = size if size is not None else {"height": 346, "width": 346} size = get_size_dict(size) @@ -133,12 +133,12 @@ def __init__( self.image_std = image_std if image_std is not None else IMAGENET_STANDARD_STD self.include_top = include_top - # Copied from transformers.models.vit.image_processing_vit.ViTImageProcessor.resize with PILImageResampling.BILINEAR->PILImageResampling.NEAREST + def resize( self, image: np.ndarray, size: dict[str, int], - resample: PILImageResampling = PILImageResampling.NEAREST, + resample: PILImageResampling = PILImageResampling.BICUBIC, data_format: Optional[Union[str, ChannelDimension]] = None, input_data_format: Optional[Union[str, ChannelDimension]] = None, **kwargs, @@ -151,8 +151,8 @@ def resize( Image to resize. size (`dict[str, int]`): Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image. - resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.NEAREST`): - `PILImageResampling` filter to use when resizing the image e.g. `PILImageResampling.NEAREST`. + resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`): + `PILImageResampling` filter to use when resizing the image e.g. `PILImageResampling.BICUBIC`. data_format (`ChannelDimension` or `str`, *optional*): The channel dimension format for the output image. If unset, the channel dimension format of the input image is used. Can be one of: diff --git a/src/transformers/models/efficientnet/image_processing_efficientnet_fast.py b/src/transformers/models/efficientnet/image_processing_efficientnet_fast.py index 93e1237f061c..4d29b8adf0e3 100644 --- a/src/transformers/models/efficientnet/image_processing_efficientnet_fast.py +++ b/src/transformers/models/efficientnet/image_processing_efficientnet_fast.py @@ -33,7 +33,7 @@ @auto_docstring class EfficientNetImageProcessorFast(BaseImageProcessorFast): - resample = PILImageResampling.NEAREST + resample = PILImageResampling.BICUBIC image_mean = IMAGENET_STANDARD_MEAN image_std = IMAGENET_STANDARD_STD size = {"height": 346, "width": 346} diff --git a/src/transformers/models/metaclip_2/convert_metaclip_2_to_hf.py b/src/transformers/models/metaclip_2/convert_metaclip_2_to_hf.py index b086a5844b34..a5292ccae108 100644 --- a/src/transformers/models/metaclip_2/convert_metaclip_2_to_hf.py +++ b/src/transformers/models/metaclip_2/convert_metaclip_2_to_hf.py @@ -26,7 +26,6 @@ # Import MetaCLIP modules from src.mini_clip.factory import create_model_and_transforms - from transformers import ( AutoTokenizer, CLIPImageProcessor,