Skip to content
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

Fix fill parameter for PIL pad #2515

Merged
merged 4 commits into from
Jul 30, 2020
Merged

Fix fill parameter for PIL pad #2515

merged 4 commits into from
Jul 30, 2020

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Jul 29, 2020

Fixes #2512

@pmeier pmeier requested review from vfdev-5 and fmassa July 29, 2020 10:37
@@ -261,8 +261,7 @@ def pad(img, padding, fill=0, padding_mode="constant"):
raise ValueError("Padding mode should be either constant, edge, reflect or symmetric")

if padding_mode == "constant":
if isinstance(fill, numbers.Number):
fill = (fill,) * len(img.getbands())
fill = _parse_fill(fill, img, "2.3.0")["fillcolor"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've traced back the min_version to python-pillow/Pillow@20b9d97, but you could probably go even further back. Still, I think its sufficient because I think a lot of the functionalities we are using require a higher version be default

@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

Merging #2515 into master will increase coverage by 0.67%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2515      +/-   ##
==========================================
+ Coverage   70.60%   71.27%   +0.67%     
==========================================
  Files          94       94              
  Lines        7995     8290     +295     
  Branches     1272     1395     +123     
==========================================
+ Hits         5645     5909     +264     
+ Misses       1947     1945       -2     
- Partials      403      436      +33     
Impacted Files Coverage Δ
torchvision/transforms/functional_pil.py 62.71% <80.00%> (-0.63%) ⬇️
torchvision/models/detection/backbone_utils.py 100.00% <0.00%> (ø)
torchvision/transforms/functional.py 81.09% <0.00%> (+0.26%) ⬆️
torchvision/transforms/functional_tensor.py 64.91% <0.00%> (+0.70%) ⬆️
torchvision/transforms/transforms.py 80.06% <0.00%> (+4.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1aef87d...f90c286. Read the comment docs.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@fmassa fmassa merged commit 37799ad into pytorch:master Jul 30, 2020
@pmeier pmeier deleted the pad-fill branch July 30, 2020 17:10
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
* fix fill parameter for PIL pad

* add test

* fix

* lint
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.

Pad() fails on floating point image with TypeError
2 participants