Michael
Michael

Reputation: 1180

tensorflow.python.framework.errors_impl.NotFoundError while generating TFRecord files Object Detection API

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:

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!

Upvotes: 4

Views: 2263

Answers (1)

Michael
Michael

Reputation: 1180

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/

Upvotes: 1

Related Questions