Pytorch and data augmentation: how to augmentate data with blur, rotations, etc
I want to do some data augmentation with Pytorch, but i don't know the libraries very well:
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.ToTensor(),
        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])
    ]),
}

Because the effects i want to do are: gaussian blur/rotation/contrast/gamma+random noise
But i have errors considering several aspects, like the size of the images doesn't match.
Any suggestions?

If you want to apply Gausian blur there is also already a pytorch class for:
torchvision.transforms.GaussianBlur(kernel_size, sigma=(0.1, 2.0))

