KEMBAR78
Update CLIPFeatureExtractor to convert PIL image to RGB by hengkuanwee · Pull Request #17101 · huggingface/transformers · GitHub
Skip to content

Conversation

@hengkuanwee
Copy link
Contributor

Currently PIL images with RGBA format throws an error when being processed by CLIPFeatureExtractor.

CLIPFeatureExtractor.normalize() throws the following error:
.../sentence-transformer/lib/python3.9/site-packages/transformers/image_utils.py", line 185, in normalize return (image - mean) / std ValueError: operands could not be broadcast together with shapes (4,224,224) (3,)

The original clip model preprocesses PIL Images by converting all PIL images into RGB format.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 5, 2022

The documentation is not available anymore as the PR was closed or merged.

@hengkuanwee
Copy link
Contributor Author

hi @patil-suraj, re-created the PR as discussed 😄

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for the PR!

@patil-suraj patil-suraj merged commit 6bc6797 into huggingface:main May 11, 2022
ArthurZucker pushed a commit to ArthurZucker/transformers that referenced this pull request May 12, 2022
Co-authored-by: kuanwee.heng <kuanwee.heng@aaqua.live>
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
Co-authored-by: kuanwee.heng <kuanwee.heng@aaqua.live>
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.

3 participants