I load the CoCo dataset with torchvision.datasets.CoCoDetection()
the example code on official doc:
cap = dset.CocoDetections(root = ‘dir where images are’,
annFile = ‘json annotation file’, transform=None,target_transform=None)
The images in this dataset has various size. So how can I resize its images to (416,416) and rescale coordinates of bounding boxes?
e.g. original size=(640,480), bounding box=[ x, y, w, h ]
processed size=(416,416), bounding box=[ x* 416/640, y* 416/480, w* 416/640, h* 416/480]
I know use the argument: transform = transforms.Resize([416,416]) can resize the images, but how can I modify those bounding box coordinates efficiently?