Hi, I am currently learning PyTorch. Following some tutorials, I have learned to do some little augmentation using PyTorch and albumentation.
But somehow the augmentation that I’ve done only augments each image once.
If I want to randomly augment to add two more data for each image (maybe rotate then crop randomly), How to do that?
Here’s my code.
My input data is already in npy form with shape [no_of_images,height,width]
Thanks!
class DataGenerator(Dataset):
    def __init__(self, x_set, y_set):
        self.x, self.y = x_set, y_set
        self.aug = A.Compose([
            A.Resize(p=1, height=512, width=256) 
        ])        

    def __len__(self):
        return len(self.x)
    
    def __getitem__(self, index):
        batch_x = self.x[index]
        batch_y = self.y[index]
        # print(batch_x.shape)
        # batch_x = batch_x[None, :, :]
        augmented = self.aug(image=batch_x, mask=batch_y)
        image, mask = augmented['image'], augmented['mask']
        #return np.expand_dims(batch_x,axis=0), batch_y
        return image[None,:,:], mask