Yes, I think the cleanest way would be to define a custom Dataset.
I’m not sure what your use case is, but I understood that you’ve already split the input images into patches. If that’s the case, you could create a mapping and store the prediction for each patch and “combine” them afterwards. E.g. if you are working on a classification use case, you could use a majority voting etc.
Hi @ptrblck. First of all I would like to thank you for your very functional code (MyDataset), however I notice that it is slow and makes training very slow. Indeed here are the times for a pass in the network and for a pass in MyDataset (4 for batch of 4).
Time of one pass in the network on GPU (with update) : 0.025026798248291016s
Time of each pass in MyDataset so 4 for batch=4 (sequence length=32):
To obtain those times I have already made a modification, basically transforming the for loop into a list of comprehension: images = [self.transform(Image.open(self.image_paths[i][0])) for i in indices]