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 x2 = bb y1 = bb y2 = bb # 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!