-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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 the get_size_with_aspect_ratio in max_size situation #30902
Conversation
Additional script
|
We can consider merging both all-in-one |
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.
Thanks for fixing!
Could you add a test, checking both the upper and lower bounds, which fail on main and pass here?
cc @qubvel
@SangbumChoi Thanks for fixing, a great catch!
will be great to have them consistent, but take into consideration that yolos function "round" height and width to the lowest divisible value |
I will update the yolos and the test function and ping again. |
@qubvel @amyeroberts I added the screenshot which fails at the main branch and success in here. For the record, I tried to make yolos consistent to all the other function. However, it turns out it needs to remove I just added test on the detr but if it seems good I could add it to all the related models. |
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.
Thanks for working on this! Overall looks good to me. It would be good to add some tests to make sure the behaviour is as expected for specific cases eg. when max_size is set or not; height < width; width < height; height == width; height == size etc.
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
I have added the 3 more cases which is total 5 cases. Note that max_size should be always set in the situation of get_size_with_aspect_ratio! Again I just added test on the detr but if it seems good I could add it to all the related models :) |
@amyeroberts Hi amy, since recent merge has deprecated DETA. I also removed in here. |
@amyeroberts Could you rerun the CI? |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Thanks for fixing!
…#30902) * fix the get_size_with_aspect_ratio in max_size situation * make fix-up * add more general solution * consider when max_size is not defined * fix typo * fix typo * simple fix * fix error * fix if else error * fix error of size overwrite * fix yolos image processing * fix detr image processing * make * add longest related test script * Update src/transformers/models/yolos/image_processing_yolos.py Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com> * add more test * add test script about longest size * remove deprecated --------- Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
What does this PR do?
This fix the issue as the following example. AKA round issue.
This is important when the size should be divisible by specific value such as 32, 16.
@amyeroberts
Before commit
After commit
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.