Skip to content
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

[Feature Request] Support same_on_batch option for transforms #2929

Open
xvjiarui opened this issue Oct 28, 2020 · 5 comments
Open

[Feature Request] Support same_on_batch option for transforms #2929

xvjiarui opened this issue Oct 28, 2020 · 5 comments

Comments

@xvjiarui
Copy link

xvjiarui commented Oct 28, 2020

🚀 Feature

In the latest torchvison, transforms support tensor input (very nice feature, cheers!).

Motivation

As titled, same_on_batch option is not available for torchvision transforms. For example, RandomResizedCrop will crop at the same location for all images in the batch (which is ideal for video, but not for batched images).

Pitch

Kornia has this feature off the shelf. Maybe torchvision could follow the same API.

cc @vfdev-5

@xvjiarui xvjiarui changed the title Support same_on_batch option for transforms [Feature Request] Support same_on_batch option for transforms Oct 28, 2020
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Oct 28, 2020

@xvjiarui thanks for the feature request ! Yes, we are also thinking about applying random transformations on each image in the batch.

@fmassa
Copy link
Member

fmassa commented Oct 30, 2020

Hi,

Thanks for opening this issue, this is indeed something we should plan to do at some point in the future.

But I think it might take some time before we get into it, because I think for a full-fleshed experience this will require torch.vmap and NestedTensor, both of which are currently prototypes in PyTorch.

I think we should be in close touch with @cpuhrsch (who is working on NestedTensor) and @zou3519 (who is working on vmap) so that we can beta-test those features in the context of this feature request.
But I wouldn't expect this feature to be included in torchvision in the next 6 months.

@mizoru
Copy link

mizoru commented Nov 22, 2022

This never materialized, right?

@AlessandroMondin00
Copy link

Any updates here? I think this would be super important

@juliendenize
Copy link

Hi,

I developed a library based on Torchvision v2 called Torchaug that aims to have batched transforms with random parameters for each sample in the batch.

For example RandomResizedCrop can be batched to handle different transforms.

I believe that as soon as vmap and nested tensors will be truly released by Pytorch, Torchvision will implement a more efficient way of doing it but this should work in the meantime :).

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

No branches or pull requests

6 participants