Skip to content

ImageListToImageBatch: make the resize check optional (much faster for long vids)#527

Open
BlakeOne wants to merge 2 commits into
ltdrdata:Mainfrom
BlakeOne:list_to_batch_optional_resize
Open

ImageListToImageBatch: make the resize check optional (much faster for long vids)#527
BlakeOne wants to merge 2 commits into
ltdrdata:Mainfrom
BlakeOne:list_to_batch_optional_resize

Conversation

@BlakeOne

@BlakeOne BlakeOne commented Mar 20, 2024

Copy link
Copy Markdown

When operating on a large batch size (eg 500) if the images are all the same size (eg a video), then the node ImageListToImageBatch takes much longer than necessary...

So this PR adds the option to skip the resize check and simply combine all of the images at once, which can be much faster from my testing (10 seconds vs 108 seconds with batch size 550, 512x512 res, tested on Colab T4).

@BlakeOne BlakeOne changed the title ImageListToImageBatch: make resize optional FIX: ImageListToImageBatch is extremely slow for long videos Apr 10, 2024
@BlakeOne BlakeOne changed the title FIX: ImageListToImageBatch is extremely slow for long videos ImageListToImageBatch: make resizing optional (much faster for long vids) Apr 11, 2024
@BlakeOne BlakeOne changed the title ImageListToImageBatch: make resizing optional (much faster for long vids) ImageListToImageBatch: make the resize check optional (much faster for long vids) Apr 11, 2024
def doit(self, images, resize):
if len(images) <= 1:
return (images,)
elif not resize[0]:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be not resize instead of not resize[0]

if len(images) <= 1:
return (images,)
elif not resize[0]:
return (torch.cat(images, dim=0),)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be advisable to use try-catch in this section to output appropriate error messages in case of exceptions.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review was pending due to my mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants