'How to add padding to an image using Detectron2 while preserving correct segmentation location?

I have a training dataset consisting of images of shape (1080, 1920, 3) I would like to augment my data by various methods, including cropping and rotating. The problem is, I am unable to reshape the images back to (1080, 1920, 3). Is there a way to reshape from a smaller crop size (e.g. (640, 640, 3)) to (1080, 1920, 3) ?

If not, I will just add padding to the images. But is there a way to do it with Detectron2 so that the location of my annotated objects also get transformed?

Thank you for the help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source