Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: Main
Choose a base branch
from

Conversation

BlakeOne
Copy link

@BlakeOne BlakeOne commented Mar 20, 2024

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
if len(images) <= 1:
return (images,)
elif not resize[0]:
Copy link
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
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
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