karl_TUM karl_TUM - 11 months ago 133
Python Question

Good way to input PASCAL-VOC 2012 training data and labels with tensorflow

I want to do object detection of PASCAL-VOC 2012 dataset with tensorflow.

I want to input the whole image with object labels and the corresponding bounding boxes into the tensorflow for training.

Is there any good way to write a data file for tensorflow to read? Or just read the original XML file in tensorflow?

Thank you very much.

Here is an image example:
enter image description here

Answer Source

It seems that TF have no support of xml files yet.

  1. You can try to make batches by yourself and feed them to TF placeholders. https://www.tensorflow.org/versions/r0.10/how_tos/reading_data/index.html#feeding

  2. You can write your own file format and your own decoder. Then you can read file and get file bytes with tf.decode_raw function and do whatever you whant. Related question if you whant to read multiple files simultaneously: Tensorflow read images with labels

I think that first option is easier to implement.