Skip to content

remove fill blending for bilinear affine #8098

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Nov 7, 2023

Fixes #8083 and addresses the corresponding part in #6517.

cc @vfdev-5

Copy link

pytorch-bot bot commented Nov 7, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8098

Note: Links to docs will display an error until the docs builds have been completed.

❌ 17 New Failures, 20 Unrelated Failures

As of commit c6e81a4 with merge base f69eee6 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Comment on lines +588 to +589
bool_mask = mask < 1
float_img[bool_mask] = fill_img.expand_as(float_img)[bool_mask]
Copy link
Member

Choose a reason for hiding this comment

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

This is only equivalent to the 'bilinear' block if mask was a boolean mask, right?

Is that the case? And if it is, why was there even a distinction between bilinear and nearest mode in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is only equivalent to the 'bilinear' block if mask was a boolean mask, right?

Yes.

Is that the case?

No.

And if it is, why was there even a distinction between bilinear and nearest mode in the first place?

I would need to dig, but maybe @vfdev-5 knows? My guess is that the blend strategy we implemented was to have a smooth transition from fill to image. And that works well if we fill with zeros, but creates a shadow artifact if we use a different fill color with bilinear interpolation. See #8083.

Meaning, this PR is BC breaking, but I consider it a bug fix since the blending behavior seems to be "nice to have" while the shadow is an actual issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it was an incorrect implementation. At the moment of PR (#2904), I thought it could be ok as assumption to linearly interpolate around the boundaries: #2904 (comment)

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.

affine creates artefacts on the edges of the image
4 participants