title: Conversion of image annotation formats into tfrecords for tensorflow object detection api
body: <p>Seeking help regarding image annotation formats for object detection API.</p>
  <blockquote>
  <ul>
  <li><strong>Foreknow:</strong></li>
  </ul>
  </blockquote>
  <p>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:</p>
  <p><strong>Pascal VOC:</strong></p>
  <ol>
  <li>Stores annotation in .xml file format.</li>
  <li>Bounding box format [x-top-left, y-top-left, x-bottom-right, y-bottom-right]</li>
  <li>Create separate xml annotation file for each image in the dataset.</li>
  </ol>
  <p><strong>COCO:</strong></p>
  <ol>
  <li>Stores annotation in .json file format.</li>
  <li>Bounding box format [x-top-left, y-top-left, width, height].</li>
  <li>Create one annotation file for each training, testing and validation.</li>
  </ol>
  <blockquote>
  <ul>
  <li><strong>Current-issue:</strong></li>
  </ul>
  </blockquote>
  <p>I have two dataset to deal and this is how they are annotated.</p>
  <p><strong>Dataset-1:</strong></p>
  <ul>
  <li>File format: Pascal VOC(.xml)</li>
  <li>Bounding box format: COCO.</li>
  <li>File creation: As in Pascal VOC(separate xml annotation file for each image in the dataset).</li>
  </ul>
  <p><strong>Dataset-2:</strong></p>
  <ul>
  <li>File format: Pascal VOC(.xml)</li>
  <li>Bounding box format: COCO.</li>
  <li>File creation: As in COCO(Create one annotation file for each training, testing and validation)</li>
  </ul>
  <p>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.</p>
  <p>For instance, in <a href="https://github.com/sglvladi/TensorFlowObjectDetectionTutorial/blob/master/docs/source/scripts/generate_tfrecord.py" rel="nofollow noreferrer">this link</a> the author wrote a script to convert .xml into .records but here it is dealing with pure pascal VOC format.</p>
  <p>And in <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/dataset_tools/create_coco_tf_record.py" rel="nofollow noreferrer">this link</a> they are dealing with pure COCO annotation formats.</p>
  <p><em>Which path should I follow as I am standing in the middle of both formats?</em></p>