Skip to content

Use antialiased bicubic resizing in Gemma 4 ViT preprocessing. - #1101

Merged
copybara-service[bot] merged 1 commit into
devfrom
test_1031162686
Dec 1, 2026
Merged

copybara-service[bot] merged 1 commit into
devfrom
test_1031162686

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Use antialiased bicubic resizing in Gemma 4 ViT preprocessing.

Reference Gemma 4 inference implementations (HuggingFace transformers and JAX
gemma) resize input images using Pillow's antialiased bicubic filter.
Previously, PrefillVitGemma4 used Image::ResizeBilinear, which aliases fine
detail when downscaling high-resolution images (for example, introducing OCR
errors on downscaled text where antialiased bicubic resizing matches the
reference preprocessing).

Replace Image::ResizeBilinear with Image::ResizeBicubic and switch
PrefillVitGemma4 to use it.

@google-cla

google-cla Bot commented Nov 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
copybara-service Bot force-pushed the test_1031162686 branch 4 times, most recently from 874f8f7 to dcb4321 Compare December 1, 2026 10:26
Reference Gemma 4 inference implementations (HuggingFace `transformers` and JAX
`gemma`) resize input images using Pillow's antialiased bicubic filter.
Previously, `PrefillVitGemma4` used `Image::ResizeBilinear`, which aliases fine
detail when downscaling high-resolution images (for example, introducing OCR
errors on downscaled text where antialiased bicubic resizing matches the
reference preprocessing).

Replace `Image::ResizeBilinear` with `Image::ResizeBicubic` and switch
`PrefillVitGemma4` to use it.

PiperOrigin-RevId: 1033367435
@copybara-service
copybara-service Bot merged commit 39bbbf7 into dev Dec 1, 2026
4 of 6 checks passed
@copybara-service
copybara-service Bot deleted the test_1031162686 branch December 1, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants