pytorch / pytorch/vision

Rename some transforms using appropriate wide adopted naming conventions

Open
#3,941 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: transforms needs discussion
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 Feature

Rename confusing transformation names such as transforms.Normalize() to transforms.Standardize() and decouple combined operations transforms.ToTensor() into transforms.Normalize()/transforms.Rescale() and transforms.ToTensor() for clarity.

Motivation

I'm always frustrated when trying to communicate the above operations (i.e. transforms.Normalize(), transforms.ToTensor()) to statisticians, the reason for that is that statisticians use the following conventional naming standardize = rescale data to zero mean and unit variance i.e., what transforms.Normalize() does, and, normalize = rescale data value into the range[0, 1], i.e., what tranforms.ToTensor() does, which is basically 2 operations, transforming the PIL image into a tensor and rescaling it.

Pitch

Is it possible to rename according to the world wide convention that statisticians use in order to avoid confusion in the future and have better clarity of what each operation is meant to be doing?

  1. Rename transforms.Normalize() into transforms.Standardize()
  2. Break transforms.ToTensor into two separate operations transforms.Normalize() which basically rescales the values into the range[0, 1], and transforms.ToTensor() which basically transforms a PIL image into a torch tensor.

cc @vfdev-5

Contributor guide

Open the contributing guide

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 by reviewing the existing transforms.Normalize() and transforms.ToTensor() APIs and their documented behavior. Compare those behaviors with the proposed Standardize(), Normalize(), Rescale(), and ToTensor() naming. Done would require an agreed migration plan and corresponding updates across the public transform API, documentation, and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.