Skip to content

Commit

Permalink
Fix image pairs length validation when using limit (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyballentine authored May 29, 2024
1 parent e340d0d commit 7311cde
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ def load_images(filepaths: tuple[Path, Path], index: int):
image_files_a: list[Path] = list_all_files_sorted(directory_a, supported_filetypes)
image_files_b: list[Path] = list_all_files_sorted(directory_b, supported_filetypes)

if use_limit:
image_files_a = image_files_a[:limit]
image_files_b = image_files_b[:limit]

assert len(image_files_a) == len(image_files_b), (
"Number of images in directories A and B must be equal. "
f"Directory A: {directory_a} has {len(image_files_a)} images. "
f"Directory B: {directory_b} has {len(image_files_b)} images."
)

if use_limit:
image_files_a = image_files_a[:limit]
image_files_b = image_files_b[:limit]

image_files = list(zip(image_files_a, image_files_b))

return (
Expand Down

0 comments on commit 7311cde

Please sign in to comment.