Hello,
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__.