How to add data augmentation with albumentation to image classification framework?
I am using pytorch for image classification using this code from github.
I need to add data augmentation before training my model,
I chose albumentation to do this.
here is my code when I add albumentation:
data_transform = {
    &quot;train&quot;: A.Compose([ 
                        A.RandomResizedCrop(224,224),
                        A.HorizontalFlip(p=0.5),
                        A.RandomGamma(gamma_limit=(80, 120), eps=None, always_apply=False, p=0.5),
                        A.RandomBrightnessContrast (p=0.5),
                        A.CLAHE(clip_limit=4.0, tile_grid_size=(8, 8), always_apply=False, p=0.5),
                        A.ShiftScaleRotate(shift_limit=0.05, scale_limit=0.05, rotate_limit=15, p=0.5),
                        A.RGBShift(r_shift_limit=15, g_shift_limit=15, b_shift_limit=15, p=0.5),
                        A.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
                        ToTensorV2(),]),
    &quot;val&quot;: A.Compose([
                      A.Resize(256,256),
                      A.CenterCrop(224,224),
                      A.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
                      ToTensorV2()])}

I got this error:

KeyError: Caught KeyError in DataLoader worker process 0.
KeyError: 'You have to pass data to augmentations as named arguments, for example: aug(image=image)'


This Albumentations function takes a positional argument 'image' and returns a dictionnary. This is a sample to use it :
transforms = A.Compose([
                A.augmentations.geometric.rotate.Rotate(limit=15,p=0.5),
                A.Perspective(scale=[0,0.1],keep_size=False,fit_output=False,p=1),
                A.Resize(224, 224),
                A.HorizontalFlip(p=0.5),
                A.GaussNoise(var_limit=(10.0, 50.0), mean=0),
                A.RandomToneCurve(scale=0.5,p=1),
                A.Normalize(mean=[0.5, 0.5, 0.5],std=[0.225, 0.225, 0.225]),
                ToTensorV2()
            ])

img = cv2.imread(&quot;dog.png&quot;)
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
transformed_img = transforms(image=img)[&quot;image&quot;]

