-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Resize not equivalent between Pillow <9 and Pillow 9.0.0 #6113
Comments
Hi. I don't quite follow your example - I don't see where "saved_resized_image_7_1_2.npy", Also, what version of NumPy are you using? |
I've updated the code snippet above to include the saving of the resized image as a NumPy array. This is all done in Google Colab. Numpy version is 1.21.5. |
On my local machine, I don't find a problem when compiling from source. Testing in Google Colab, I was able to reproduce this - but only when I didn't compile from source. So it's not a change in Pillow's code itself, but presumably one of the dependencies in our wheels. The image that you're specifying is a JPEG, so my guess would be that this is because we switched to libjpeg-turbo in our wheels. |
@NielsRogge did that answer your question? |
Yes, visually the differences are minor, so I'm going to update the expected outputs of our models. Thanks for looking into it! |
Hi Pillow folks,
Thanks for creating this awesome library. We're using Pillow to prepare images for several computer vision algorithms in HuggingFace Transformers.
However, we noticed that, after Pillow 9.0.0, some integration tests of our models were failing (models didn't get the exact same output tensors anymore on the same images). Visually there's not really an impact on the models, they perform similar, but it's strange that Pillow's resize method gives different results. Is this expected?
To reproduce:
Then, resize as follows:
(I did this both on Pillow 7.1.2 and Pillow 9.0.1). I save a resized image as follows:
When comparing the values by turning them into NumPy arrays and using assert allclose:
I'm getting:
The text was updated successfully, but these errors were encountered: