Hey, I have this following piece of code:
# image is a torch tensors being on the gpu representing an image
# bounding boxes is a list of lists describing 4 coordinates
for bb in bounding_boxes:
x1 = bb[0]
x2 = bb[1]
y1 = bb[2]
y2 = bb[3]
# cutout image
image_cutout = image[y1:y2, x1:x2, ...]
# here do some operation on image_cutout on the gpu
# paste it back
image[y1:y2, x1:x2, ...] = image_cutout
Is there some way to vectorize this? I would like to, having all the image cutouts, put them back into original image. Thanks for any help!