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

Add size argument to GroundingDinoProcessor call (pass it to GroundingDinoImageProcessor) #32304

Closed
saskiabosma opened this issue Jul 29, 2024 · 2 comments
Labels
Feature request Request for a new feature

Comments

@saskiabosma
Copy link

saskiabosma commented Jul 29, 2024

Feature request

When creating a GroundingDinoProcessor object, it is currently not possible to pass a size to which the image processor would resize the image before passing it on. Since GroundingDinoProcessor passes the images to GroundingDinoImageProcessor, which itself allows a "do_resize" and "size" argument, it would be a simple change to allow custom resizing.

Motivation

This feature is interesting to have when performing inferences on images that are small, since the current default resizing is putting the shortest edge at 800px or the longest edge at 1333px, and inference speed depends strongly on image size. It also helps with GPU memory usage.

I saw a 60% speed difference for inference on one image when manually forcing sizes around 400px. I also went from GPU OOM errors when using a batch of 2 ~400px pictures to no issues for batches of > 20 pictures.

Your contribution

I'm willing to do the PR if the maintainers think this is a good change!

@saskiabosma saskiabosma added the Feature request Request for a new feature label Jul 29, 2024
@zucchini-nlp
Copy link
Member

Hey! If I understood correctly, you want to pass image processing related arguments when doing processor(text, images). We are working on it and standardizing kwargs for processors.

GroundingDINO PR is here (#31964) to keep track of the progress :)

@saskiabosma
Copy link
Author

Yes, this PR would solve my issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants