I have a dataset includes thousands of images and the resolution is 2048 by 2048. I want to use a small patch (like 256 by 256) as a single example. One image can generate couples(like 20 or 50) of examples and they are composed to a training batch as the input. If I use the Dataset class and DataLoader function, the DataLoader will read a single image and crop a patch then read another image and crop another patch and so on. Then all these patch from different images are composed to a image. That is not what I want to do. I want one batch come from one image.
Is there some way to  Manually generate training batch?