How to use transform.fivecrop(size) in custom dataset

When I use transforms.FiveCrop(20) in the custom dataset, Then pytorch dataloader gives me (128,5,3,20,20) shapes of batches where 128 is the batchsize, 5 comes from croping an image at 5 different places and remaining is channel, width and height.
What I want is that I get only 128 images in the batch.

In that case you could:

  • manually crop at a specific location only
  • use FiveCrop and just return a single location (randomly selected or fixed)
  • reduce the batch size by a factor of ~5 and collapse the crops into the batch size to get ~128 samples per batch