Fix MobileNet v1/v2 image processor default interpolation to BICUBIC#43313
Open
VedantMadane wants to merge 2 commits intohuggingface:mainfrom
Open
Fix MobileNet v1/v2 image processor default interpolation to BICUBIC#43313VedantMadane wants to merge 2 commits intohuggingface:mainfrom
VedantMadane wants to merge 2 commits intohuggingface:mainfrom
Conversation
Member
|
cc @NielsRogge if that issue is still relevant! If not we should close it, since I think a lot of people and code agents are searching for old open issues lately |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: mobilenet_v1, mobilenet_v2 |
The MobileNet image processors were defaulting to BILINEAR interpolation, but the original timm implementation uses BICUBIC. This change aligns transformers with timm's preprocessing. Contributes to huggingface#28180
Update MobileNetV1ImageProcessorFast and MobileNetV2ImageProcessorFast to use PILImageResampling.BICUBIC instead of BILINEAR, matching the changes made to the slow image processors.
96e6dbc to
73d24bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the default interpolation method for MobileNet v1 and v2 image processors from BILINEAR to BICUBIC, matching the original timm implementation.
Motivation
As part of #28180, we need to verify that image processor interpolation methods match their original implementations. The MobileNet models in timm use BICUBIC interpolation for preprocessing, but the transformers image processors were defaulting to BILINEAR.
Changes
resamplefromPILImageResampling.BILINEARtoPILImageResampling.BICUBICresamplefromPILImageResampling.BILINEARtoPILImageResampling.BICUBICVerification
The timm documentation confirms MobileNet models use bicubic interpolation:
Contributes to #28180