Get location of RandomCrop

Hello Tristan,

I’m not sure if there’s a way to do this directly, but you can write your own custom transform that does retain the coordinates, while piggybacking on the RandomCrop sampler, per ptrblck’s suggestion here.

Specifically, this bit:

self.crop_indices = transforms.RandomCrop.get_params(
                image, output_size=(512, 512))
i, j, h, w = self.crop_indices  # btw i think h, w are just always going to be 512, 512 here
image = TF.crop(image, i, j, h, w)

If you post your solution in a public repo perhaps others would use it as well. I can imagine the usefulness extends to other Random* transforms.

Best,
Andrei