I am wondering if there are any vectorized methods for creating a batch patches out of a single image.
Suppose I have an image. (a Tenosr of size C, H, W)
And I am trying to create a specific number of randomly cropped patches, say 16.
The final shape would be [number of patches (16), number of channels (3), height after cropped, width after cropped]
Then the most straightforward way might be looping each patch, 16 times in this case,
then create each patch with something similiar to the following snippet.
patches[loop_idx] = img[:, min_h : max_h, min_w : max_w]
I guess this will do what I need.
I, however, am wondering if there are any vectorized ways that do the same thing so that I don’t have to loop the number of patches.