Skip to content

Added center arg to F.affine and RandomAffine ops #5208

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
Jan 24, 2022

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Jan 18, 2022

Related to #5204

Description:

  • Added center arg to F.affine and RandomAffine ops
  • tests

Example from #5204 (comment)

from PIL import Image
import math
import torchvision # >= 0.11

from torchvision.transforms import functional as F
interpolation = torchvision.transforms.InterpolationMode.NEAREST
fill = None

img = Image.new('RGB', (32,32), (255,255,0))
magnitude = .7

im_torch = F.affine(
    img, angle=0.0, translate=[0, 0], scale=1.0, shear=[math.degrees(magnitude), 0.0],
    interpolation=interpolation, fill=fill, center=[0, 0])

image

@facebook-github-bot
Copy link

facebook-github-bot commented Jan 18, 2022

💊 CI failures summary and remediations

As of commit 76dbebf (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

@vfdev-5 Thanks for the PR. The changes look good, I only added a comment for an unimplemented feature left in.

I think it would be useful also to document a bit the approach of this PR by adding references to specific papers or implementations that follow your approach for centering.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @vfdev-5.

@vfdev-5 vfdev-5 merged commit 59c723c into pytorch:main Jan 24, 2022
@vfdev-5 vfdev-5 deleted the improved-affine branch January 24, 2022 18:12
facebook-github-bot pushed a commit that referenced this pull request Feb 3, 2022
Summary:
* Added center option to F.affine and RandomAffine ops

* Updates according to the review

Reviewed By: kazhang

Differential Revision: D33927487

fbshipit-source-id: 3e6562977c7948331982fa5f788f7933744917ac
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