pytorch / pytorch/vision

[RFC] Different menaning of angle parameter in affine and rotate ops

Open
#5,608 2 comments 1 reaction 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

In Torchvision stable API, there are 2 ops: affine and rotate that has angle as parameter.

However, positive angle parameter in F.affine op performs clockwise rotation.

https://github.com/pytorch/vision/blob/8aadef5f55a8a0098de943dbf0480a796022e825/torchvision/transforms/functional.py#L1092

while in F.rotate it is an opposite meaning, it does counter clockwise rotation:

https://github.com/pytorch/vision/blob/8aadef5f55a8a0098de943dbf0480a796022e825/torchvision/transforms/functional.py#L1004

For Detectron2, Pillow or albumentations, they do counter clockwise rotation for positive angle value.

Question: Should we align F.affine op to perform counter clockwise rotation for positive angle value ?

cc @vfdev-5 @datumbox

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

Compare the affine and rotate implementations in torchvision/transforms/functional.py at the linked locations, then review how the angle convention is described for each operation. Check the cited Detectron2, Pillow, and albumentations conventions before proposing an API decision. Done means the convention is agreed and the affected documentation, tests, and behavior changes are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
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.