4

I am trying to generate TFRecord files from Pascal VOC format dataset. I am following this guide and used this instructions to create pascal_train.record and pascal_val.record.

I have already prepared annotations, images and image sets in ImageSets -> Main. Also generated label map in pascal_label_map.pbtxt.

Now, when run following command from tf_worspace/models:

python3 object_detection/create_pascal_tf_record.py \
--label_map_path=object_detection/data/pascal_label_map.pbtxt \
--data_dir=VOCdevkit --year=VOC2012 --set=train \
--output_path=pascal_train.record

I get:

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.NotFoundError: VOCdevkit/VOC2012/ImageSets/Main/marlboro_red_train.txt

My project structure is as follow:

  • tf_workspace
    • models (TF staff here...)
      • object_detection
        • VOCdevkit
          • VOC2012
            • Annotations
            • ImageSets
              • Action (my annotations here)
              • Layout
              • Main (my imagesets here)
                • marlboro_red_train.txt
                • marlboro_red_val.txt
                • marlboro_red_trainval.txt
                • ...
              • Segmentation
            • JPEGImages (my images here)
            • SegmentationClass
            • SegmentationObject

The file that script cannot find for some reasons exist in that directory, I have checked few times.

Be sure I changed following line in create_pascal_tf_record.py:

examples_path = os.path.join(data_dir, year, 'ImageSets', 'Main',
                                 'aeroplane_' + FLAGS.set + '.txt')

to:

examples_path = os.path.join(data_dir, year, 'ImageSets', 'Main',
                                 'marlboro_red_' + FLAGS.set + '.txt')

So what is going on? Can anybody explain why it gives such error, please! Thanks in advance for any hint!

1 Answer 1

1

Ok, so the reason was because of wrong parameters. As this guide says:

Make sure VOCdevkit is inside models/object_detection then you can go ahead and generate the TFRecords.

So what I had to do is simply change this line:

--data_dir=VOCdevkit

to:

--data_dir=object_detection/VOCdevkit/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.