How do I apply same transformations to image and mask?

You can either use the functional API as described here or torchvision.transforms.v2 which allows to pass multiple objects as described here .

3 Likes