6
$\begingroup$

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?

$\endgroup$

2 Answers 2

4
$\begingroup$

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.

$\endgroup$
0
0
$\begingroup$

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())

https://chitra.readthedocs.io/en/latest/

pip install chitra

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.