Jump to content
Maryam

Conversion of image annotation formats into tfrecords for tensorflow object detection api

Recommended Posts

Hi,

I am new to this platform and here to seek help regarding image annotation formats for object detection API. 

 

  • Foreknow:

As, we know there are two annotation formats for images, Pascal VOC and COCO formats. Both have their own specification here's the main difference between both:

Pascal VOC:

  1. Stores annotation in .xml file format.
  2. Bounding box format [x-top-left, y-top-left, x-bottom-right, y-bottom-right]
  3. Create separate xml annotation file for each image in the dataset.

COCO:

  1. Stores annotation in .json file format.
  2. Bounding box format [x-top-left, y-top-left, width, height].
  3. Create one annotation file for each training, testing and validation.

 

  • Current-issue:

I have two dataset to deal and this is how they are annotated.

Dataset-1:

  1. File format: Pascal VOC(.xml)
  2. Bounding box format: COCO.
  3. File creation: As in Pascal VOC(separate xml annotation file for each image in the dataset).

Dataset-2:

  1. File format: Pascal VOC(.xml)
  2. Bounding box format: COCO.
  3. File creation: As in COCO(Create one annotation file for each training, testing and validation)

 

The thing that I am not able to get pass through is which format(Pascal VOC or COCO) should I follow to convert my annotations into Tfrecords(.xml to .records) as use can see the annotations of dataset aren't purely belong to any of one format.

 

For instance, in the link below author wrote a script to convert .xml into .records but here it is dealing with pure pascal VOC format.

https://github.com/sglvladi/TensorFlowObjectDetectionTutorial/blob/master/docs/source/scripts/generate_tfrecord.py

 

And in this link they are dealing with pure COCO annotation formats.

https://github.com/tensorflow/models/blob/master/research/object_detection/dataset_tools/create_coco_tf_record.py

 

Which path should I follow as I am standing in the middle of both formats?

Edited by Maryam

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×