Add Fast Image Processor for PoolFormer#37182
Conversation
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
|
cc @yonigozlan |
yonigozlan
left a comment
There was a problem hiding this comment.
Great work again @rootonchair ! Almost ready to merge :)
| crop_top = int((image_height - crop_height) / 2.0) | ||
| crop_left = int((image_width - crop_width) / 2.0) |
There was a problem hiding this comment.
Do you get exactly equivalent result with slow image processors using this rather than the torchvision center_crop?
This has been an issue to fix in my backlog for a while, so thanks for addressing it 🤗. We can keep it here for now but I might use it in the base fast image processor class at some point, but we need a separate PR for that as it will impact a lot of models.
There was a problem hiding this comment.
Yes, according to the test, slow and fast center_crop produces the same result. I came across this issue while trying to fix the unit test. It turns out that the problem was slow center_crop trying to rounding down the coordinates while the fast one rounding it up. Feel free to use it at ease and don't hesitate to reach out if you have any questions 🤗
| @require_torch | ||
| @require_vision | ||
| class PoolFormerImageProcessingCropPctTest(PoolFormerImageProcessingTest): | ||
| def setUp(self): | ||
| super().setUp() | ||
| self.image_processor_tester = PoolFormerImageProcessingTester(self, crop_pct=None) |
There was a problem hiding this comment.
is this to test without crop pct? it might be better to rename this PoolFormerImageProcessingNoCropPctTest otherwise it's kind of confusing
There was a problem hiding this comment.
Yes it is. I will change the name to make more sense
|
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. |
* support poolformer fast image processor * support test for crop_pct=None * run make style * Apply suggestions from code review * rename test --------- Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com>
What does this PR do?
Related #36978
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.