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 for rotate fill with Images of type F #1828

Merged
merged 1 commit into from
Jan 29, 2020
Merged

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented Jan 29, 2020

Bugfix which was introduced in #1760.

It turns out that whenever the image is of type F we can't pass a tuple of one element for fill but instead we need indeed to pass it as a number.

cc @pmeier

@@ -1078,7 +1078,7 @@ def test_rotate(self):
def test_rotate_fill(self):
img = F.to_pil_image(np.ones((100, 100, 3), dtype=np.uint8) * 255, "RGB")

modes = ("L", "RGB")
modes = ("L", "RGB", "F")
nums_bands = [len(mode) for mode in modes]
fill = 127
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets see if this works with mode=="F" and an int value >1.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can create F images with arbitrary float values in it, including > 1 it seems

PIL.Image.fromarray(np.full((10, 10), 5.))

@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #1828 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1828   +/-   ##
======================================
  Coverage    0.43%   0.43%           
======================================
  Files          92      92           
  Lines        7386    7386           
  Branches     1111    1111           
======================================
  Hits           32      32           
  Misses       7346    7346           
  Partials        8       8
Impacted Files Coverage Δ
torchvision/transforms/functional.py 0% <0%> (ø) ⬆️

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 30538b5...4850783. Read the comment docs.

@fmassa fmassa merged commit 9e8258d into pytorch:master Jan 29, 2020
@fmassa fmassa deleted the bugfix-fill branch January 29, 2020 11:59
fmassa added a commit to fmassa/vision-1 that referenced this pull request Jan 29, 2020
facebook-github-bot pushed a commit that referenced this pull request Jan 29, 2020
Summary: Pull Request resolved: #1829

Reviewed By: lerks

Differential Revision: D19619779

Pulled By: fmassa

fbshipit-source-id: 0a210f90d58102da59dfb8ab1b3f93c619d0507f
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