Skip to content

Commit

Permalink
fix-copies
Browse files Browse the repository at this point in the history
  • Loading branch information
yonigozlan committed Dec 11, 2024
1 parent 3f8674f commit f12c5d7
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/transformers/models/aria/image_processing_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,14 @@
PILImageResampling,
get_image_size,
infer_channel_dimension_format,
is_valid_image,
make_batched_images,
to_numpy_array,
valid_images,
validate_preprocess_arguments,
)
from ...utils import TensorType


def make_batched_images(images) -> List[List[ImageInput]]:
"""
Accepts images in list or nested list format, and makes a list of images for preprocessing.
Args:
images (`Union[List[List[ImageInput]], List[ImageInput], ImageInput]`):
The input image.
Returns:
list: A list of images.
"""
if isinstance(images, (list, tuple)) and isinstance(images[0], (list, tuple)) and is_valid_image(images[0][0]):
return [img for img_list in images for img in img_list]

elif isinstance(images, (list, tuple)) and is_valid_image(images[0]):
return images

elif is_valid_image(images):
return [images]

raise ValueError(f"Could not make batched video from {images}")


def divide_to_patches(image: np.array, patch_size: int, input_data_format) -> List[np.array]:
"""
Divides an image into patches of a specified size.
Expand Down

0 comments on commit f12c5d7

Please sign in to comment.