-
Notifications
You must be signed in to change notification settings - Fork 31.5k
Fixed EfficientNet interpolation method to match the original implementation #42860
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
base: main
Are you sure you want to change the base?
Fixed EfficientNet interpolation method to match the original implementation #42860
Conversation
…ntation in the code Original method --> Bicubic\ Source: tpu/models/official/efficientnet/preprocessing.py Function def _resize_image() Line 88 - Changed default resample from Nearest to BICUBIC - Original Tensorflow implementation uses resize_bicubic by default in original code - Fixes Issue huggingface#28180
- Reorder imports in metaclip_2 conversion script to satisfy ruff formatter - Remove -> None annotation from EfficientNetImageProcessor.__init__ to match docstring checker expectations
|
[For maintainers] Suggested jobs to run (before merge) run-slow: efficientnet, metaclip_2 |
yonigozlan
left a comment
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.
Happy to merge this as it is indeed the wrong default, however you also have to change it for the fast image processor!
| self.include_top = include_top | ||
|
|
||
| # Copied from transformers.models.vit.image_processing_vit.ViTImageProcessor.resize with PILImageResampling.BILINEAR->PILImageResampling.NEAREST | ||
| # Method for resize bicubic interpolation |
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.
| # Method for resize bicubic interpolation |
|
|
||
| # Import MetaCLIP modules | ||
| from src.mini_clip.factory import create_model_and_transforms | ||
|
|
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.
can be reverted
| @@ -0,0 +1,579 @@ | |||
| # Image Processor Interpolation Method Verification Guide | |||
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.
To delete!
What does this PR do?
Fixes the default interpolation method for EfficientNet image processor from
NEARESTtoBICUBICto match the original TensorFlow implementation.Motivation
As pointed out in #28180 to check the models in the list, the EfficientNet image processor was using
NEARESTinterpolation , but the original TensorFlow implementation usesBICUBICby default.The
_resize_image()function in the original code explicitly usestf.image.resize_bicubicas the default resize method.Changes
resampleparameter fromPIL.Image.NEARESTtoPILImageResampling.BICUBICFixes #28180 (partial - for EfficientNet model)
Before submitting
cc @yonigozlan @molbap (vision models reviewers)