Skip to content

Add warning in docs of Resize about different results for PIL and tensors #3615

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

Merged
merged 3 commits into from
Mar 31, 2021

Conversation

NicolasHug
Copy link
Member

This PR adds a warning in the docs indicating that PIL images and tensors may be transformed differently, even on the same data. This is a source of confusion according to the comments in #2950 and explicitly documenting this may help

@NicolasHug
Copy link
Member Author

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.

I would instead mention that the outputs might be different because PIL applies antialiasing while torch tensor don't use antialiasing, and that the difference is only visible for downsampling the image, and upsampling should lead to similar results.

Also, cc @vfdev-5 for the work on adding antialiasing support to interpolate.

@codecov
Copy link

codecov bot commented Mar 30, 2021

Codecov Report

Merging #3615 (6928b0d) into master (7d955df) will decrease coverage by 0.20%.
The diff coverage is n/a.

❗ Current head 6928b0d differs from pull request most recent head 45b7b12. Consider uploading reports for the commit 45b7b12 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3615      +/-   ##
==========================================
- Coverage   79.69%   79.48%   -0.21%     
==========================================
  Files         105      105              
  Lines        9824     9822       -2     
  Branches     1583     1582       -1     
==========================================
- Hits         7829     7807      -22     
- Misses       1517     1527      +10     
- Partials      478      488      +10     
Impacted Files Coverage Δ
torchvision/transforms/functional.py 81.77% <ø> (-0.09%) ⬇️
torchvision/transforms/transforms.py 84.30% <ø> (ø)
torchvision/utils.py 62.09% <0.00%> (-16.94%) ⬇️
torchvision/datasets/folder.py 78.57% <0.00%> (+1.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 7d955df...45b7b12. 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!

@fmassa fmassa merged commit 591c899 into pytorch:master Mar 31, 2021
facebook-github-bot pushed a commit that referenced this pull request Apr 13, 2021
…L and tensors (#3615)

Summary:
* docs for resize

* address comment: describe antialiasing

Reviewed By: NicolasHug

Differential Revision: D27706945

fbshipit-source-id: e48c865c09f204b75d5e209a7ba45166fc913e18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants