-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Fix image segmentation tool bug #23897
Fix image segmentation tool bug #23897
Conversation
@sgugger @LysandreJik The fix is pretty simple, but in the spirit of Chesterton's fence, I wasn't sure/couldn't remember the reason for the |
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but let's wait for @LysandreJik as he wrote this tool :-)
This seems reasonable! I had run into issues where I couldn't segment images with different sizes when implementing it. I have tried with different flavors of the following and it seems to work well even without specifying the size. Your change looks good to me @amyeroberts; are you aware of sizes that may not work with this model? |
@LysandreJik It should all be OK if the image processor matches the model: there shouldn't be any sizes that don't work because the image processor will resize as needed. In terms of sizes that won't work:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @amyeroberts!
What does this PR do?
Currently tools using the ImageSegmentation tool fail because the parameters for the image processor are overridden with the input image dimensions. This results in incompatible input dimensions being passed to the model.
This PR removes this logic in the
encode
method and removes the resizing in the tests which only happened for the segmentation tool and hid the issue.Fixes #23328
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.