Unverified Commit 71025520 authored by Wesley L Passos's avatar Wesley L Passos Committed by GitHub
Browse files

Fix docstring get maskformer resize output image size (#27196)

* fix docstring in get_maskformer_resize_output_image_size

* fix  functions docstring

* fix 'copied from' functions docstring

* fix docstring

* fix return type

* fix docstring resize
parent ae093eef
...@@ -304,21 +304,23 @@ def get_mask2former_resize_output_image_size( ...@@ -304,21 +304,23 @@ def get_mask2former_resize_output_image_size(
size_divisor: int = 0, size_divisor: int = 0,
default_to_square: bool = True, default_to_square: bool = True,
input_data_format: Optional[Union[str, ChannelDimension]] = None, input_data_format: Optional[Union[str, ChannelDimension]] = None,
) -> tuple: ) -> Tuple[int, int]:
""" """
Computes the output size given the desired size. Computes the output size given the desired size.
Args: Args:
input_image (`np.ndarray`): image (`np.ndarray`):
The input image. The input image.
size (`int`, `Tuple[int, int]`, `List[int]`, `Tuple[int]`): size (`int` or `Tuple[int, int]` or `List[int]` or `Tuple[int]`):
The size of the output image. The size of the output image.
default_to_square (`bool`, *optional*, defaults to `True`):
Whether to default to square if no size is provided.
max_size (`int`, *optional*): max_size (`int`, *optional*):
The maximum size of the output image. The maximum size of the output image.
size_divisible (`int`, *optional*, defaults to 0): size_divisor (`int`, *optional*, defaults to 0):
If size_divisible is given, the output image size will be divisible by the number. If `size_divisor` is given, the output image size will be divisible by the number.
default_to_square (`bool`, *optional*, defaults to `True`):
Whether to default to square if no size is provided.
input_data_format (`ChannelDimension` or `str`, *optional*):
The channel dimension format of the input image. If unset, will use the inferred format from the input.
Returns: Returns:
`Tuple[int, int]`: The output size. `Tuple[int, int]`: The output size.
...@@ -471,10 +473,10 @@ class Mask2FormerImageProcessor(BaseImageProcessor): ...@@ -471,10 +473,10 @@ class Mask2FormerImageProcessor(BaseImageProcessor):
size (`Dict[str, int]`): size (`Dict[str, int]`):
The size of the output image. The size of the output image.
size_divisor (`int`, *optional*, defaults to 0): size_divisor (`int`, *optional*, defaults to 0):
If size_divisor is given, the output image size will be divisible by the number. If `size_divisor` is given, the output image size will be divisible by the number.
resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`): resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`):
Resampling filter to use when resizing the image. Resampling filter to use when resizing the image.
data_format (`str` or `ChannelDimension`, *optional*): data_format (`ChannelDimension` or `str`, *optional*):
The channel dimension format for the output image. If unset, the channel dimension format of the input The channel dimension format for the output image. If unset, the channel dimension format of the input
image is used. image is used.
input_data_format (`ChannelDimension` or `str`, *optional*): input_data_format (`ChannelDimension` or `str`, *optional*):
......
...@@ -306,21 +306,23 @@ def get_maskformer_resize_output_image_size( ...@@ -306,21 +306,23 @@ def get_maskformer_resize_output_image_size(
size_divisor: int = 0, size_divisor: int = 0,
default_to_square: bool = True, default_to_square: bool = True,
input_data_format: Optional[Union[str, ChannelDimension]] = None, input_data_format: Optional[Union[str, ChannelDimension]] = None,
) -> tuple: ) -> Tuple[int, int]:
""" """
Computes the output size given the desired size. Computes the output size given the desired size.
Args: Args:
input_image (`np.ndarray`): image (`np.ndarray`):
The input image. The input image.
size (`int`, `Tuple[int, int]`, `List[int]`, `Tuple[int]`): size (`int` or `Tuple[int, int]` or `List[int]` or `Tuple[int]`):
The size of the output image. The size of the output image.
default_to_square (`bool`, *optional*, defaults to `True`):
Whether to default to square if no size is provided.
max_size (`int`, *optional*): max_size (`int`, *optional*):
The maximum size of the output image. The maximum size of the output image.
size_divisible (`int`, *optional*, defaults to 0): size_divisor (`int`, *optional*, defaults to 0):
If size_divisible is given, the output image size will be divisible by the number. If `size_divisor` is given, the output image size will be divisible by the number.
default_to_square (`bool`, *optional*, defaults to `True`):
Whether to default to square if no size is provided.
input_data_format (`ChannelDimension` or `str`, *optional*):
The channel dimension format of the input image. If unset, will use the inferred format from the input.
Returns: Returns:
`Tuple[int, int]`: The output size. `Tuple[int, int]`: The output size.
...@@ -479,10 +481,10 @@ class MaskFormerImageProcessor(BaseImageProcessor): ...@@ -479,10 +481,10 @@ class MaskFormerImageProcessor(BaseImageProcessor):
size (`Dict[str, int]`): size (`Dict[str, int]`):
The size of the output image. The size of the output image.
size_divisor (`int`, *optional*, defaults to 0): size_divisor (`int`, *optional*, defaults to 0):
If size_divisor is given, the output image size will be divisible by the number. If `size_divisor` is given, the output image size will be divisible by the number.
resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`): resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`):
Resampling filter to use when resizing the image. Resampling filter to use when resizing the image.
data_format (`str` or `ChannelDimension`, *optional*): data_format (`ChannelDimension` or `str`, *optional*):
The channel dimension format for the output image. If unset, the channel dimension format of the input The channel dimension format for the output image. If unset, the channel dimension format of the input
image is used. image is used.
input_data_format (`ChannelDimension` or `str`, *optional*): input_data_format (`ChannelDimension` or `str`, *optional*):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment