Applying self transform to image of a dictionary

i have a dictionary defined in the dataloader
def getitem(self, idx):

    image_name = os.path.join(self.__image_path, self.__image_names[idx])
    image = io.imread(image_name)
    joints = self.__mat_data[:-1, :, idx]
    sample = {'image': image, 'joints': joints}
    if self.transform:
        sample = self.transform(sample)
        img = sample['image']
        label = sample['joints']
    return sample

i want to apply vertical flip and rotation to the image of this.
How do i write down the self transform
is it self.transform(img)=transforms.compose(transforms.randomverticalflip)
or is there a way to do this outside of dataloader?

You can use OpenCV library for transformations like these (cv2.flip, cv2.rotate)

You can use Albumentations library. It’s very straight forward to use and supports image with different type of targets.