Skip to content

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

Closed
@saskiabosma

Description

@saskiabosma

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions