Using Polygons instead of Boxes

Hi

How do I load data into a standard PyTorch Dataset, specifying labels with corresponding points representing polygon regions, instead of simple xmin,xmax,ymin,ymax boxes?

Hello Ian,
pls specify your question and tell us what you want to do, so that we can understand what you mean.

Hi Luis

Thank you for the reply.
I have since written a script to ‘cut-out’ images - based on polygon points into standard to rectangles which I then load into a dataset. Therefore, I did not have to adapt the dataset, instead the bounding box is now the full size of the image 0,0,width,height.

Example of images that have been ‘cut-out’

However, my ML model performs poorly - I am still learning how to ues these im
ages properly, also not sure if I should use those with a black or white background or not.

Formal_4_9_CROPPED
Formal_4_9_MASK
Formal_4_9_MASK_ONLY
Formal_4_9_MASK_White_BG

Formal_2_4_CROPPED
Formal_2_4_MASK
Formal_2_4_MASK_ONLY
Formal_2_4_MASK_White_BG

For four point defined polygons you can use Kornia warp_perspective

Tutorial here: Warp image using perspective transform - Kornia Tutorials documentation