diff --git a/src/transformers/models/conditional_detr/image_processing_conditional_detr.py b/src/transformers/models/conditional_detr/image_processing_conditional_detr.py index c7bc27207bd30d..a2c4537bc48731 100644 --- a/src/transformers/models/conditional_detr/image_processing_conditional_detr.py +++ b/src/transformers/models/conditional_detr/image_processing_conditional_detr.py @@ -877,16 +877,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -1011,14 +1009,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format @@ -1364,17 +1359,12 @@ def preprocess( ) do_pad = kwargs.pop("pad_and_return_pixel_mask") - max_size = None if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size - size = get_size_dict(size=size, max_size=max_size, default_to_square=False) + size = get_size_dict(size=size, default_to_square=False) resample = self.resample if resample is None else resample do_rescale = self.do_rescale if do_rescale is None else do_rescale rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor @@ -1470,7 +1460,7 @@ def preprocess( for image, target in zip(images, annotations): orig_size = get_image_size(image, input_data_format) resized_image = self.resize( - image, size=size, max_size=max_size, resample=resample, input_data_format=input_data_format + image, size=size, resample=resample, input_data_format=input_data_format ) resized_annotation = self.resize_annotation( target, orig_size, get_image_size(resized_image, input_data_format) diff --git a/src/transformers/models/deformable_detr/image_processing_deformable_detr.py b/src/transformers/models/deformable_detr/image_processing_deformable_detr.py index 0b6a58eb8f1351..05c2d24e9db241 100644 --- a/src/transformers/models/deformable_detr/image_processing_deformable_detr.py +++ b/src/transformers/models/deformable_detr/image_processing_deformable_detr.py @@ -875,16 +875,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -1009,14 +1007,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format @@ -1362,17 +1357,12 @@ def preprocess( ) do_pad = kwargs.pop("pad_and_return_pixel_mask") - max_size = None if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size - size = get_size_dict(size=size, max_size=max_size, default_to_square=False) + size = get_size_dict(size=size, default_to_square=False) resample = self.resample if resample is None else resample do_rescale = self.do_rescale if do_rescale is None else do_rescale rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor @@ -1468,7 +1458,7 @@ def preprocess( for image, target in zip(images, annotations): orig_size = get_image_size(image, input_data_format) resized_image = self.resize( - image, size=size, max_size=max_size, resample=resample, input_data_format=input_data_format + image, size=size, resample=resample, input_data_format=input_data_format ) resized_annotation = self.resize_annotation( target, orig_size, get_image_size(resized_image, input_data_format) diff --git a/src/transformers/models/deformable_detr/image_processing_deformable_detr_fast.py b/src/transformers/models/deformable_detr/image_processing_deformable_detr_fast.py index 0a2fbc14ee94f8..283599263fb895 100644 --- a/src/transformers/models/deformable_detr/image_processing_deformable_detr_fast.py +++ b/src/transformers/models/deformable_detr/image_processing_deformable_detr_fast.py @@ -353,16 +353,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -779,11 +777,8 @@ def preprocess( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") + do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size size = get_size_dict(size=size, default_to_square=False) diff --git a/src/transformers/models/detr/image_processing_detr.py b/src/transformers/models/detr/image_processing_detr.py index 85fbe698d10a12..412bb0d218f881 100644 --- a/src/transformers/models/detr/image_processing_detr.py +++ b/src/transformers/models/detr/image_processing_detr.py @@ -859,16 +859,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -990,14 +988,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format @@ -1337,17 +1332,12 @@ def preprocess( ) do_pad = kwargs.pop("pad_and_return_pixel_mask") - max_size = None if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size - size = get_size_dict(size=size, max_size=max_size, default_to_square=False) + size = get_size_dict(size=size, default_to_square=False) resample = self.resample if resample is None else resample do_rescale = self.do_rescale if do_rescale is None else do_rescale rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor @@ -1443,7 +1433,7 @@ def preprocess( for image, target in zip(images, annotations): orig_size = get_image_size(image, input_data_format) resized_image = self.resize( - image, size=size, max_size=max_size, resample=resample, input_data_format=input_data_format + image, size=size, resample=resample, input_data_format=input_data_format ) resized_annotation = self.resize_annotation( target, orig_size, get_image_size(resized_image, input_data_format) diff --git a/src/transformers/models/detr/image_processing_detr_fast.py b/src/transformers/models/detr/image_processing_detr_fast.py index f010ffe272294f..323bea2239a758 100644 --- a/src/transformers/models/detr/image_processing_detr_fast.py +++ b/src/transformers/models/detr/image_processing_detr_fast.py @@ -362,16 +362,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -779,11 +777,8 @@ def preprocess( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") + do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size size = get_size_dict(size=size, default_to_square=False) diff --git a/src/transformers/models/grounding_dino/image_processing_grounding_dino.py b/src/transformers/models/grounding_dino/image_processing_grounding_dino.py index 569e22ba470007..a86999aefe9a18 100644 --- a/src/transformers/models/grounding_dino/image_processing_grounding_dino.py +++ b/src/transformers/models/grounding_dino/image_processing_grounding_dino.py @@ -883,16 +883,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -1017,14 +1015,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format @@ -1370,17 +1365,12 @@ def preprocess( ) do_pad = kwargs.pop("pad_and_return_pixel_mask") - max_size = None if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in a future version, use" - " `size['longest_edge']` instead." - ) - size = kwargs.pop("max_size") + logger.error("The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.") do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size - size = get_size_dict(size=size, max_size=max_size, default_to_square=False) + size = get_size_dict(size=size, default_to_square=False) resample = self.resample if resample is None else resample do_rescale = self.do_rescale if do_rescale is None else do_rescale rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor @@ -1476,7 +1466,7 @@ def preprocess( for image, target in zip(images, annotations): orig_size = get_image_size(image, input_data_format) resized_image = self.resize( - image, size=size, max_size=max_size, resample=resample, input_data_format=input_data_format + image, size=size, resample=resample, input_data_format=input_data_format ) resized_annotation = self.resize_annotation( target, orig_size, get_image_size(resized_image, input_data_format) diff --git a/src/transformers/models/rt_detr/image_processing_rt_detr.py b/src/transformers/models/rt_detr/image_processing_rt_detr.py index d031f40848fb8c..e4bb86203b9451 100644 --- a/src/transformers/models/rt_detr/image_processing_rt_detr.py +++ b/src/transformers/models/rt_detr/image_processing_rt_detr.py @@ -453,6 +453,8 @@ def __init__( **kwargs, ) -> None: size = size if size is not None else {"height": 640, "width": 640} + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size size = get_size_dict(size, default_to_square=False) if do_convert_annotations is None: @@ -531,14 +533,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format diff --git a/src/transformers/models/yolos/image_processing_yolos.py b/src/transformers/models/yolos/image_processing_yolos.py index 19b21333f60912..5d3b20e04f0a92 100644 --- a/src/transformers/models/yolos/image_processing_yolos.py +++ b/src/transformers/models/yolos/image_processing_yolos.py @@ -791,16 +791,14 @@ def __init__( do_pad = kwargs.pop("pad_and_return_pixel_mask") if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None if size is None else 1333 size = size if size is not None else {"shortest_edge": 800, "longest_edge": 1333} - size = get_size_dict(size, max_size=max_size, default_to_square=False) + # Backwards compatibility + size = {"shortest_edge": size, "longest_edge": 1333} if isinstance(size, int) else size + size = get_size_dict(size, default_to_square=False) # Backwards compatibility if do_convert_annotations is None: @@ -925,14 +923,11 @@ def resize( The channel dimension format of the input image. If not provided, it will be inferred. """ if "max_size" in kwargs: - logger.warning_once( - "The `max_size` parameter is deprecated and will be removed in v4.26. " - "Please specify in `size['longest_edge'] instead`.", + logger.error( + "The `max_size` parameter is deprecated. " "Please specify in `size['longest_edge'] instead`.", ) - max_size = kwargs.pop("max_size") - else: - max_size = None - size = get_size_dict(size, max_size=max_size, default_to_square=False) + + size = get_size_dict(size, default_to_square=False) if "shortest_edge" in size and "longest_edge" in size: new_size = get_resize_output_image_size( image, size["shortest_edge"], size["longest_edge"], input_data_format=input_data_format @@ -1274,17 +1269,14 @@ def preprocess( ) do_pad = kwargs.pop("pad_and_return_pixel_mask") - max_size = None if "max_size" in kwargs: - logger.warning_once( - "The `max_size` argument is deprecated and will be removed in v4.33, use" - " `size['longest_edge']` instead.", + logger.error( + "The `max_size` argument is deprecated, use" " `size['longest_edge']` instead.", ) - size = kwargs.pop("max_size") do_resize = self.do_resize if do_resize is None else do_resize size = self.size if size is None else size - size = get_size_dict(size=size, max_size=max_size, default_to_square=False) + size = get_size_dict(size=size, default_to_square=False) resample = self.resample if resample is None else resample do_rescale = self.do_rescale if do_rescale is None else do_rescale rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor @@ -1379,7 +1371,7 @@ def preprocess( for image, target in zip(images, annotations): orig_size = get_image_size(image, input_data_format) resized_image = self.resize( - image, size=size, max_size=max_size, resample=resample, input_data_format=input_data_format + image, size=size, resample=resample, input_data_format=input_data_format ) resized_annotation = self.resize_annotation( target, orig_size, get_image_size(resized_image, input_data_format) diff --git a/tests/models/conditional_detr/test_image_processing_conditional_detr.py b/tests/models/conditional_detr/test_image_processing_conditional_detr.py index 32b135bcd220bd..e15e782206bbcc 100644 --- a/tests/models/conditional_detr/test_image_processing_conditional_detr.py +++ b/tests/models/conditional_detr/test_image_processing_conditional_detr.py @@ -156,7 +156,7 @@ def test_image_processor_from_dict_with_kwargs(self): self.assertEqual(image_processor.do_pad, True) image_processor = self.image_processing_class.from_dict( - self.image_processor_dict, size=42, max_size=84, pad_and_return_pixel_mask=False + self.image_processor_dict, size={"shortest_edge": 42, "longest_edge": 84}, pad_and_return_pixel_mask=False ) self.assertEqual(image_processor.size, {"shortest_edge": 42, "longest_edge": 84}) self.assertEqual(image_processor.do_pad, False) diff --git a/tests/models/deformable_detr/test_image_processing_deformable_detr.py b/tests/models/deformable_detr/test_image_processing_deformable_detr.py index 4a65f1b8d17864..93882ebef5c6d1 100644 --- a/tests/models/deformable_detr/test_image_processing_deformable_detr.py +++ b/tests/models/deformable_detr/test_image_processing_deformable_detr.py @@ -162,7 +162,9 @@ def test_image_processor_from_dict_with_kwargs(self): self.assertEqual(image_processor.do_pad, True) image_processor = image_processing_class.from_dict( - self.image_processor_dict, size=42, max_size=84, pad_and_return_pixel_mask=False + self.image_processor_dict, + size={"shortest_edge": 42, "longest_edge": 84}, + pad_and_return_pixel_mask=False, ) self.assertEqual(image_processor.size, {"shortest_edge": 42, "longest_edge": 84}) self.assertEqual(image_processor.do_pad, False) diff --git a/tests/models/detr/test_image_processing_detr.py b/tests/models/detr/test_image_processing_detr.py index f91c520873668f..90a9273151189a 100644 --- a/tests/models/detr/test_image_processing_detr.py +++ b/tests/models/detr/test_image_processing_detr.py @@ -165,7 +165,9 @@ def test_image_processor_from_dict_with_kwargs(self): self.assertEqual(image_processor.do_pad, True) image_processor = image_processing_class.from_dict( - self.image_processor_dict, size=42, max_size=84, pad_and_return_pixel_mask=False + self.image_processor_dict, + size={"shortest_edge": 42, "longest_edge": 84}, + pad_and_return_pixel_mask=False, ) self.assertEqual(image_processor.size, {"shortest_edge": 42, "longest_edge": 84}) self.assertEqual(image_processor.do_pad, False) diff --git a/tests/models/grounding_dino/test_image_processing_grounding_dino.py b/tests/models/grounding_dino/test_image_processing_grounding_dino.py index bb8b9272efc952..d3bc31ee1e123f 100644 --- a/tests/models/grounding_dino/test_image_processing_grounding_dino.py +++ b/tests/models/grounding_dino/test_image_processing_grounding_dino.py @@ -177,7 +177,9 @@ def test_image_processor_from_dict_with_kwargs(self): self.assertEqual(image_processor.do_pad, True) image_processor = image_processing_class.from_dict( - self.image_processor_dict, size=42, max_size=84, pad_and_return_pixel_mask=False + self.image_processor_dict, + size={"shortest_edge": 42, "longest_edge": 84}, + pad_and_return_pixel_mask=False, ) self.assertEqual(image_processor.size, {"shortest_edge": 42, "longest_edge": 84}) self.assertEqual(image_processor.do_pad, False) diff --git a/tests/models/yolos/test_image_processing_yolos.py b/tests/models/yolos/test_image_processing_yolos.py index 67508532e9c829..bd0821ff3f56a7 100644 --- a/tests/models/yolos/test_image_processing_yolos.py +++ b/tests/models/yolos/test_image_processing_yolos.py @@ -167,7 +167,7 @@ def test_image_processor_from_dict_with_kwargs(self): self.assertEqual(image_processor.do_pad, True) image_processor = self.image_processing_class.from_dict( - self.image_processor_dict, size=42, max_size=84, pad_and_return_pixel_mask=False + self.image_processor_dict, size={"shortest_edge": 42, "longest_edge": 84}, pad_and_return_pixel_mask=False ) self.assertEqual(image_processor.size, {"shortest_edge": 42, "longest_edge": 84}) self.assertEqual(image_processor.do_pad, False)