Efficient way to crop and resize

Hi Im doing crop and resize during training, but the number of boxes in each image is too large so that the time consumption in crop and resize operation for each box seems to be heavy.
I wonder is there any tools that can efficiently operate crop and resize. (e.g, batched mode for crop and resize)

Try roi_pool or roi_align in torchvision.

Thanks. That might be a good option.
I forgot to mention I have to zero pad to the cropped image to maintain aspect ratio…
I.E. crop->pad->resize

A lot of searching but it seems that the operation should be done with each box solely…

roi_align takes output_size as an input. You dont have to zero pad it to maintain aspect ratio unless you want to do it that way.