How to Create Tfrecords from Partial Pascal VOC XML Annotation Format for Object Detection

Pascal VOC XML Annotation Format

Difference between object detection annotation formats

Partial Pascal VOC XML Annotation

In my case, I encountered a dataset that is annotated in partial Pascal VOC format. Here’s what I mean by partial Pascal VOC format annotations.

Dataset 1: Annotation file for one image.
Dataset 2: One annotation file for whole training dataset.

Partial Pascal VOC Format to Pascal VOC Format

For converting these XML labels, I reused the Lyudmil Vladimirov script and made the following changes accordingly in the create_tf_example function to make it suitable for Pascal VOC format.

Summary

If you have Pascal VOC annotations with COCO bounding boxes, add the given Width value to X and Height value to Y to attain xmax and ymax values. In this way, you will get [xmin, xmax, ymin, ymax] from [X, Y, Width, Height].

Learner.