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]
Based on your code each image will be randomly augmented in the epoch.
If you want to return the same image using different augmentations (and thus increase the number of samples in the epoch) you could just call self.aug multiple times and return all augmented images.
Hi… My question is quite different but related to augmentation, I am working on a project in which I have to detect some products from different distance ,angle , lighting etc. but for training dataset I have images from same distance so how can I robust my model so that it can detect products from different distances, kindly let me know which augmentation I should try for this use case.
That’s a tricky use case, as your training data doesn’t fit the expected test data domain.
I assume that at least your test set contains the expected images taken from different distances etc.
Otherwise your training would be “blind” and you would only get the real performance after deploying the model.
That being said, you could certainly try to use an aggressive data augmentation and hope to capture the expected transformations already during the training. Based on your description you could try to use resizing, rotation, and generally a combination of affine transformations.
Hello there , I’m new to PyTorch, I’ve created a dataset that is having x-ray images and it is transformed but after creating the dataset I’m not getting good test accuracy so i have decided to do augmentation but I don’t know how to do augmentation on already created dataset .