Repository: huggingface/transformers
Pull request: 🚨Fix default interpolation for PVT to match original implementation (Bicubic)

# What does this PR do?

This PR updates the default interpolation method for `PvtImageProcessor` (both standard and fast versions) from `BILINEAR` to `BICUBIC`.

# Motivation

The original PVT implementation follows the DeiT training recipe, which relies on Bicubic interpolation.
Additionally, the `timm` library (the standard reference for this model) uses `interpolation='bicubic'` for all PVT variants.
Vision Transformers generally require Bicubic interpolation to preserve high-frequency details during patch embedding.

# Checklist
- [x] I have updated the interpolation to `PILImageResampling.BICUBIC`.

Changed files:
filename: src/transformers/models/pvt/image_processing_pvt.py
patch: @@ -47,7 +47,7 @@ class PvtImageProcessor(BaseImageProcessor):
         size (`dict`, *optional*, defaults to `{"height": 224, "width": 224}`):
             Size of the output image after resizing. Can be overridden by the `size` parameter in the `preprocess`
             method.
-        resample (`PILImageResampling`, *optional*, defaults to `Resampling.BILINEAR`):
+        resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`):
             Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
             `preprocess` method.
         do_rescale (`bool`, *optional*, defaults to `True`):
@@ -73,7 +73,7 @@ def __init__(
         self,
         do_resize: bool = True,
         size: dict[str, int] | None = None,
-        resample: PILImageResampling = PILImageResampling.BILINEAR,
+        resample: PILImageResampling = PILImageResampling.BICUBIC,
         do_rescale: bool = True,
         rescale_factor: int | float = 1 / 255,
         do_normalize: bool = True,
@@ -93,12 +93,11 @@ def __init__(
         self.image_mean = image_mean if image_mean is not None else IMAGENET_DEFAULT_MEAN
         self.image_std = image_std if image_std is not None else IMAGENET_DEFAULT_STD
 
-    # Copied from transformers.models.vit.image_processing_vit.ViTImageProcessor.resize
     def resize(
         self,
         image: np.ndarray,
         size: dict[str, int],
-        resample: PILImageResampling = PILImageResampling.BILINEAR,
+        resample: PILImageResampling = PILImageResampling.BICUBIC,
         data_format: str | ChannelDimension | None = None,
         input_data_format: str | ChannelDimension | None = None,
         **kwargs,
@@ -111,8 +110,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.BILINEAR`):
-                `PILImageResampling` filter to use when resizing the image e.g. `PILImageResampling.BILINEAR`.
+            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:
@@ -129,6 +128,7 @@ def resize(
         Returns:
             `np.ndarray`: The resized image.
         """
+
         size = get_size_dict(size)
         if "height" not in size or "width" not in size:
             raise ValueError(f"The `size` dictionary must contain the keys `height` and `width`. Got {size.keys()}")
@@ -171,7 +171,7 @@ def preprocess(
                 Dictionary in the format `{"height": h, "width": w}` specifying the size of the output image after
                 resizing.
             resample (`PILImageResampling` filter, *optional*, defaults to `self.resample`):
-                `PILImageResampling` filter to use if resizing the image e.g. `PILImageResampling.BILINEAR`. Only has
+                `PILImageResampling` filter to use if resizing the image e.g. `PILImageResampling.BICUBIC`. Only has
                 an effect if `do_resize` is set to `True`.
             do_rescale (`bool`, *optional*, defaults to `self.do_rescale`):
                 Whether to rescale the image values between [0 - 1].

filename: src/transformers/models/pvt/image_processing_pvt_fast.py
patch: @@ -20,7 +20,7 @@
 
 @auto_docstring
 class PvtImageProcessorFast(BaseImageProcessorFast):
-    resample = PILImageResampling.BILINEAR
+    resample = PILImageResampling.BICUBIC
     image_mean = IMAGENET_DEFAULT_MEAN
     image_std = IMAGENET_DEFAULT_STD
     size = {"height": 224, "width": 224}