About torchvision.transforms for segmentation task

when I use torchvison.transforms to Data Augmentation for segmentation task‘s input image and label,How can I guarantee that the two operations are the same?

image input

 input_transform = transform.Compose([
            transform.Normalize([.485, .456, .406], [.229, .224, .225])])

label input

 input_transform = transform.Compose([

Make sure the rotation angle is the same?

Hi, https://github.com/pytorch/vision/releases/tag/v0.2.0 will help you.


You could create a random number to control the transform synchronized.

import torchvision.transfroms.functional as TF
if random.random() > 0.5:
    image = TF.rotate(image, angle)
    label = TF.rotate(image, angle)

And wraping it in you custom dataset, calling it in __getitem__.

angle How can get it? thanks