I need to load a batch of 16 images and process it (Step 1), and then I need to apply a different transformation to each of these images and then process it (Step 2). I need to iterate Step 2 few times. How to do it in PyTorch?
I think you could apply your workflow as described. Load the images and apply the transformations in a loop for each image using the desired configuration.
Currently I am trying like the following:
def mytransform(self, x): for i in x.shape: x[i,:,:,:] = self.transform(x[i,:,:,:]) return x def train(self): for (x,y) in loader: xt = self.mytransform(x) process(xt) ...
but is there any efficient way to do it?
fixmatch uses strong and weak augmentation on same batch .
it might help you to find a solution.