-
Notifications
You must be signed in to change notification settings - Fork 7.1k
F.pad
is broken for PIL images and fill: str
#5627
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
Comments
That's indeed a very convenient bug. We should remove it rather than fix it, I agree. Nevertheless we should consider removing/deprecating string colours from the transforms not only for pad but also for all other transforms as these won't be compatible with the new API for non-PIL images. |
In total are two mentions of vision/torchvision/transforms/transforms.py Line 403 in 053e7eb
vision/torchvision/transforms/transforms.py Line 598 in 053e7eb
vision/torchvision/transforms/functional.py Line 451 in 9edd22c
vision/torchvision/transforms/functional_pil.py Lines 157 to 158 in 9edd22c
The only "non-pad" reference is on |
How about random erasing's value? vision/torchvision/transforms/transforms.py Lines 1653 to 1654 in 9edd22c
I suspect that string is not really supported there so worth checking. There might be more like this. Worth having a deep check on the code to config these are the only references. |
Good catch. I only looked for |
Looking again for all vision/torchvision/transforms/transforms.py Lines 1653 to 1656 in 9edd22c
|
Uh oh!
There was an error while loading. Please reload this page.
On the surface
F.pad
for PIL images seems to support str arguments forfill
:vision/torchvision/transforms/functional_pil.py
Lines 157 to 158 in 053e7eb
Internally though, it calls
_parse_fill
vision/torchvision/transforms/functional_pil.py
Lines 304 to 308 in 053e7eb
which in most cases relies on fill being numeric. Thus, actually passing a string doesn't work although PIL supports it.
This traces back to #2284 and specifically to
vision/torchvision/transforms/functional.py
Lines 334 to 337 in 37a0d8d
which will makes no sense for
fill: str
.Given that #2284 was included from
0.7.0
upwards and we haven't gotten any report yet, my guess is that the functionality is not really used. Since we want to deprecatefill: str
anyway (#5621 (comment)), I would opt to simply remove all mentions of it. Thoughts?cc @vfdev-5 @datumbox
The text was updated successfully, but these errors were encountered: