# Does resizing images during training affect the bounding box annotations?

I am using the TensorFlow object detection API to train my own custom dataset and am preparing annotations for the same. I see from the config file of my pre-trained SSD inception net, the size of the image is reduced to 300 x 300 during training. My doubt is whether the resize will now change the position of my object according to annotation? I mean now the xmin, ymin width and height of the bounding box would be different since it resized. Should I annotate on the resized images (resize them myself before training?) or the original one that I give to training?

My doubt is whether the resize would now change the position of my object according to annotation?

Yes, it will.

should i annotate on the resized images(resize them myslef before training?)

No, you should annotate at the original size.

You solve this by applying the corresponding transformations on your bounding boxas well. So if you resize your image, you rescale your bounding box. This allows you to expand to different image augmentations without redoing annotations for all of them.

I recommend you to chose a library that has to ability to apply transformations on both images and their bounding boxes. I use albumentations but there are others such as imaug.

• Thanks for the info. Oct 14, 2019 at 7:13

Another way of doing this is to use CHITRA. It can rescale your bounding box automatically based on the new image size.(chitra uses imgaug internally)

image = Chitra(img_path, box, label)

image.resize_image_with_bbox((224, 224))

print('rescaled bbox:', image.bboxes)
plt.imshow(image.draw_boxes())