Data augmentation with several efects

Hi, i have a dataset of X different classes. My main goal is to augmentate my data with:

  • gaussian blur
  • rotation
  • contrast
  • gamma+random noise
    Generating 20 images per image, i.e, 5 times this effects for each image.

I tried this:

def gaussian_blur(img):

    image = np.array(img)

    image_blur = cv2.GaussianBlur(image,(65,65),10)

    new_image = image_blur

    im = Image.fromarray(new_image) 

    return im

data_transforms = {

    'train': transforms.Compose([

        transforms.RandomRotation([-8,+8]),

        transforms.Lambda(gaussian_blur),

        transforms.ColorJitter(brightness=0, contrast=0.4, saturation=0, hue=0),

        transforms.Compose([transforms.Lambda(lambda x : x + torch.randn_like(x))]),

        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])

    ]),

    'val': transforms.Compose([

        transforms.RandomRotation([-8,+8]),

        transforms.Lambda(gaussian_blur),

        transforms.ColorJitter(brightness=0, contrast=0.4, saturation=0, hue=0),

        transforms.Compose([transforms.Lambda(lambda x : x + torch.randn_like(x))]),

        transforms.ToTensor(),

        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])

    ]),

}

But i have errors, also because i dont know how to use it.
Any suggestion?

What kind of errors are you seeing?
Could you post them with the complete stack trace, please?