Skip to content

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

Open
copybara-service[bot] wants to merge 1 commit into
devfrom
test_1031162686
Open

copybara-service[bot] wants to merge 1 commit into
devfrom
test_1031162686

Conversation

@copybara-service

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).

Add 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.

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).

Add `Image::ResizeBicubic` and switch `PrefillVitGemma4` to use it.

PiperOrigin-RevId: 1031162686
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