Skip to content

Rotation sampling grid is undesireably low-res #9029

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
danielgordon10 opened this issue Apr 22, 2025 · 1 comment
Open

Rotation sampling grid is undesireably low-res #9029

danielgordon10 opened this issue Apr 22, 2025 · 1 comment

Comments

@danielgordon10
Copy link

🐛 Describe the bug

x_grid = torch.linspace(-ow * 0.5 + d, ow * 0.5 + d - 1, steps=ow, device=theta.device)

This function that creates the resampling grid will use the default tensor dtype. If this is bfloat16/float16 and the image is sufficiently large (over 250x250 px), this results in significant quantizing that seems undesirable. The output will look extremely subsampled from the original. This would not occur if the dtype was higher precision.

My suggestion would be to update these linspace to either be dtype=theta.dtype or explicitly dtype=torch.float32 to prevent this from happening.

Versions

Current

@NicolasHug
Copy link
Member

Thanks for the report @danielgordon10 . This area of the transforms isn't actively developed / maintained anymore. We are now supporting the torchvision.transforms.v2 namespace. Can you please clarify whether you're observing the same issue with the utilities in v2? Also, can you please provide a minimal reproducing example, to give us an idea of which public APIs are impacted? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants