-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Float PILImage not converted as writeable #2194
Comments
In your snippet code, |
Sorry, forgot that. Now added, it's the PIL image... |
Yeap. I got the same warning as you. @fmassa Do you thing if we need a fix for this? |
@pmeier had a quick look at both suggestions:
|
It was meant as suggestion where we should fix this. If I understood @fmassa correctly |
@pmeier is correct, and About the |
FYI this happens with "normal" loading as well like opening a png with PIL Image, as luminance image for example, and then doing tvt.functional.pil_to_tensor warns this warning. Doesn't have to be a float image. pic = Image.open(fn).convert(mode='L') => the warning, ending with: |
🐛 Bug
When we have a float PIL-Image (e.g. mode='F'), e.g. for the purpose of applying transforms to it, and finally convert it with
ToTensor
then it will print the warningThe writeability of the numpy array got lost somewhere when converting a numpy array to PILImage with
Image.fromarray(numpy_array, mode='F')
and then after some transforms to a tensor withToTensor
.This does not happen with PIL Images other than float (e.g. mode='RGB').
This warning is especially annoying since it gets printed every epoch.
To Reproduce
Steps to reproduce the behavior:
This code will print above warning.
Also note the following:
As workaround I do the following:
Expected behavior
Warning is not printed and ToTensor method can deal with the misbehaviour of PIL image.
Environment
The text was updated successfully, but these errors were encountered: