pytorch / pytorch/pytorch.github.io

Unclear class parameters description in torchvision.transforms

Open
#220 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
285
Forks
317
PR merge metrics
No merged PRs in 30d

Description

📚 Documentation

https://pytorch.org/docs/stable/torchvision/transforms.html#transforms-on-pil-image

For many of the Transforms on PIL Image classes in torchvision.transforms, there are optional 'interpolation' and 'resample' class parameters that use a mysterious int input.
Ex: torchvision.transforms.Resize
I believe the below is the mapping of int values to image interpolations for torchvision.transforms.Resize, which I found in the PIL.Image.Resize documentation.
NEAREST = NONE = 0
LANCZOS = ANTIALIAS = 1
BILINEAR = LINEAR = 2
BICUBIC = CUBIC = 3
BOX = 4
HAMMING = 5

I think the torchvision.transforms docs should explicitly list the mapping of interpolation/resample filter types for better clarity. I had to look through PIL.Image.resize() source code to find the mapping for the 'interpolation' parameter in torchvision.transforms.Resize, which is harder than it needs be.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the torchvision.transforms documentation linked in the issue, focusing on the Resize class and its interpolation or resample parameters. Confirm the integer-to-filter mapping against the referenced PIL.Image.resize behavior, then document the supported values so the page clearly explains each filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.