Models: object_detection:InvalidArgumentError: Failed to create a NewWriteableFile

Created on 15 Aug 2017  ·  30Comments  ·  Source: tensorflow/models

when I python create_pascal_tf_record.py to convert voc2007 into the TFRecord file format,Error as follow:

Traceback (most recent call last):
File "create_pascal_tf_record.py", line 182, in
tf.app.run()
File "C:\abc\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "create_pascal_tf_record.py", line 156, in main
writer = tf.python_io.TFRecordWriter(FLAGS.output_path)
File "C:\abc\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\libio\tf_record.py", line 106, in __init__
compat.as_bytes(path), compat.as_bytes(compression_type), status)
File "C:\abc\Anaconda3\envs\python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
File "C:\abc\Anaconda3\envs\python35\lib\site-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.InvalidArgumentError: Failed to create a NewWriteableFile: 'E:\data' : \udcce\u013c\udcfe\udcc3\udcfb\udca1\udca2\u013fxbc\udcc3\udcfb\udcbb\udcf2\udcbe\udced\udcb1\udcea\udcd3\ufde8\udcb2\udcbb\udcd5\udcfd\u0237\udca1\udca3


and I run python train.py to train my data also have the error


Traceback (most recent call last):
File "train.py", line 198, in
tf.app.run()
File "C:\abc\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train.py", line 143, in main
model_config, train_config, input_config = get_configs_from_pipeline_file()
File "train.py", line 103, in get_configs_from_pipeline_file
text_format.Merge(f.read(), pipeline_config)
File "C:\abc\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\libio\file_io.py", line 118, in read
self._preread_check()
File "C:\abc\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\libio\file_io.py", line 78, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\abc\Anaconda3\envs\python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
File "C:\abc\Anaconda3\envs\python35\lib\site-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.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: 'E:\TF-OD-Test\models-master\models-master\object_detection\models\ssd_mobilenet_v1_pets.config' : \udcce\u013c\udcfe\udcc3\udcfb\udca1\udca2\u013fxbc\udcc3\udcfb\udcbb\udcf2\udcbe\udced\udcb1\udcea\udcd3\ufde8\udcb2\udcbb\udcd5\udcfd\u0237\udca1\udca3


I can't understand the error,pelese help me. thanks

Most helpful comment

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error

All 30 comments

@jch1 @tombstone @derekjchow @jesu9 @dreamdragon

Any update? I am having the same problem.

tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: ssd_mobilenet_v1_pets.config

I am using Windows 10, Python 3.6, Tensorflow 1.3 and I am having the same problem. Is this an error when running on Windows?

To solve this problem, I follow the instructions in the train.py and swap the order of 2 parameters: "pipeline_config_path" with "the train_dir"

When I try this mnist=input_data.read_data_sets("D:\pyprogram",one_hot=True) on different computer
It can pass on win7,but can't on win10
My solution is:
change "D:\pyprogram" to "D:\pyprogram\"
dont know why,but it works

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error

Did anyone solve it?

Check all of your text based config/map files.
If any paths have '\' chracter in your files, training fails.
Ex)
(X) "C:\tensorflow\models\research\data\label_map.pbtxt"
(O) "C:/tensorflow/models/research/data/label_map.pbtxt"

@rootskj Both \ nor / all not work

I solved the problem.
But my English is not good enough to write the details.
Please visit mt blog to realize the process through pictures.
http://tn00343140a.pixnet.net/blog/post/203522324-tensorflow%E5%A0%B1%E9%8C%AF

 python train.py --logtostderr --train_dir = training / --pipeline_config_path =training/faster_rcnn_inception_v2_pets.config
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "train.py", line 93, in main
    FLAGS.pipeline_config_path)
  File "C:\tensorflow1\models\research\object_detection\utils\config_util.py", line 93, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
    self._preread_check()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 85, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile failed to Create/Open: = : Access is denied.
; Input/output error.

Upon running as admin error changes to ::

   \trainer.py:260: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "train.py", line 180, in main
    graph_hook_fn=graph_rewriter_fn)
  File "D:\Studies\Python Scripts\Test\trainer.py", line 274, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)
  File "D:\Studies\Python Scripts\Test\trainer.py", line 59, in create_input_queue
    tensor_dict = create_tensor_dict_fn()
  File "train.py", line 120, in get_next
    return dataset_util.make_initializable_iterator(

Just trying to train a model and Stuck with these errors. while Object detection with normal models work as expected.

I try below command to solve the problem in win10
python -m retrain --bottleneck_dir=bottlenecks --how_many_training_steps=500 --model_dir=models --summaries_dir=tf_files --output_graph=retrained.pb --output_labels=retrained_labels.txt --architecture="mobilenet_0.50_224" --image_dir=flower_photos

HI guys.
I also have same problem,

python generate_tfrecord.py --csv_input=C:\tensorflow1\models\research\object_detectionimages\train_labels.csv --image_dir=C:\tensorflow1\models\research\object_detectionimages\train --output_path=train.record
Traceback (most recent call last):
File "generate_tfrecord.py", line 100, in
tf.app.run()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "generate_tfrecord.py", line 91, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 46, in create_tf_example
encoded_jpg = fid.read()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\libio\file_io.py", line 125, in read
self._preread_check()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\libio\file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:\tensorflow1\models\research\object_detectionimages\trainBloodImage_00003 : \udcc1\udcf6\udcc1\udca4\udcb5\udcc8 \udcc6\udcc4\udcc0\udccf\udcc0\udcbb xe3\udcc0\udcbb \udcbc\udcf6 \udcbe\udcf8\udcbd\udcc0\udcb4\u03f4\udcd9.
; No such file or directory

This is my error message. so I was confused, but this problem can be solved that so easy..
If when you are making '.csv file' using a 'xml_to_csv file.py'.
you have to check the file extension such as .jpg , .png , .jpeg
and then, containing file extension to image file name at the 'csv file'
for example.

image

finally, I can implement 'generate_tfrecord.py'

thanks, good luck to everyone

Just checked with the object detection team who maintains these research models. They do not support Windows, so I'm closing this issue. You can try following object detection instructions for running on google cloud.

For those who want to try running it locally on Windows anyway and have these issues: I would suggest looking into how your various files & paths are encoded, and making sure it is all windows-compatible.

I can operate on the windows10, tensorflow-gpu 1.10 version, cuda 9.0 & cudnn 7

basically, I refer to this video(https://youtu.be/Rgpfk6eYxJA)
but, be careful. several process is wrong. check the reply and Publisher comment at the youtube.

if you have a problem when you are running 'generate_tfrecord.py' file.
check 'train.csv' and 'test.csv' files that should have a file extension.

image

'xml_to_csv.py' was edited to rename the image file.

just edit part of last line +".jpg" , if you have a .png or .jpeg. do to change +".png" , +".jpeg"
and then you could get a modified csv files.

I have the same problem, and I found my mistake, fyi~
The "PATH_TO_BE_CONFIGURED" in the path should be deleted, And all of the "PATH_TO_BE_CONFIGURED" shoule be replaced with your own right path.
I wish have some help for you!

wrong way----------------------
input_path: "PATH_TO_BE_CONFIGURED/E:/Study_Data/DeepLearning/TensorFlow/my_data/data/pet_faces_train.record-?????-of-00010"
wrong way----------------------

right way:---------------------------
input_path: "E:/Study_Data/DeepLearning/TensorFlow/my_data/data/pet_faces_train.record-?????-of-00010"
right way:---------------------------

when i run the eval.py ,got the wrong
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\tensorflow\WAGE\test\ssd_mobilenet_v2_coco.config\ :

Is there a document that says which parts of Tensorflow are Windows compatible?

Hi @caseymeiz, Tensorflow itself (https://github.com/tensorflow/tensorflow) is Windows compatible. Likewise the official models in the Tensorflow models repo (https://github.com/tensorflow/models/tree/master/official) should also work in Windows. If you find issues in those with Windows please let us know!

However, the research models in https://github.com/tensorflow/models/tree/master/research are maintained by researchers who may or may not choose to support Windows. The models themselves should still run on Windows, but many of these models also incorporate various data munging & formatting code that might not play nicely with Windows encodings, file permissions, and paths out of the box.

windows 10, tensorflow-gpu-1.11, python3.6
The same problem. When I want to train my own data and try to open my config file, it posted an error

_"tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: $C:\Users\13302\Documents\TOD\models\research\objectdetection\training\pets.config : The filename, directory name, or volume label syntax is incorrect.
; Unknown error"_

Have anybody fixed this?

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error

please help me!!!!! how can solve this problem?

This problem is caused by wrong file extensions. If you add the file extensions in the test and train labels files (csv), it will work.

EDIT: read the post from LEESHACK, it can save you a lot of time...

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error

Were you able to solve it. I am facing the same issue

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error
do you solve it?

I'm using windows 10, python 3.7 & tensorflow r1.14. I get this problem

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

WARNING:tensorflow:From C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\platform\app.py:125: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
WARNING:tensorflow:From C:\Tensorflow\models\research\object_detection\legacy\trainer.py:266: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
WARNING:tensorflow:From C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Traceback (most recent call last):
File "train.py", line 184, in
tf.app.run()
File "C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
return func(args, *kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:\Tensorflow\models\research\object_detection\legacy\trainer.py", line 280, in train
train_config.prefetch_queue_capacity, data_augmentation_options)
File "C:\Tensorflow\models\research\object_detection\legacy\trainer.py", line 59, in create_input_queue
tensor_dict = create_tensor_dict_fn()
File "train.py", line 121, in get_next
dataset_builder.build(config)).get_next()
File "C:\Tensorflow\models\research\object_detection\builders\dataset_builder.py", line 124, in build
num_additional_channels=input_reader_config.num_additional_channels)
File "C:\Tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 307, in __init__
default_value=''),
File "C:\Tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 59, in __init__
label_map_proto_file, use_display_name=False)
File "C:\Tensorflow\models\research\object_detection\utils\label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "C:\Tensorflow\models\research\object_detection\utils\label_map_util.py", line 133, in load_labelmap
label_map_string = fid.read()
File "C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\libio\file_io.py", line 125, in read
self._preread_check()
File "C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\libio\file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Users\Asus\Miniconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 528, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: C:\Tensorflow\workspace raining_demonnotations\label_map.pbtxt : The filename, directory name, or volume label syntax is incorrect.
; Unknown error

does anyone know how to solve it?

You need to move the label_map.pbtxt to the right location. Make sure it's in the training folder of your main directory

I had the same issue ... I solved it .. actually I did small wrong before after labelling the image I change the name of the file after that I change file to CSV file and try to change to tfrecord file .. but got the same error ... while checking it i found a small change in annotation file .. becaz the filename different in image and csv i got the error .. after i change it.. now its working good

HI guys.
I also have same problem,

python generate_tfrecord.py --csv_input=C:\tensorflow1\models\research\object_detectionimages\train_labels.csv --image_dir=C:\tensorflow1\models\research\object_detectionimages\train --output_path=train.record
Traceback (most recent call last):
File "generate_tfrecord.py", line 100, in
tf.app.run()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "generate_tfrecord.py", line 91, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 46, in create_tf_example
encoded_jpg = fid.read()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\libio\file_io.py", line 125, in read
self._preread_check()
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\libio\file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Users\lileej\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:\tensorflow1\models\research\object_detectionimages\trainBloodImage_00003 : \udcc1\udcf6\udcc1\udca4\udcb5\udcc8 \udcc6\udcc4\udcc0\udccf\udcc0\udcbb xe3\udcc0\udcbb \udcbc\udcf6 \udcbe\udcf8\udcbd\udcc0\udcb4\u03f4\udcd9.
; No such file or directory

This is my error message. so I was confused, but this problem can be solved that so easy..
If when you are making '.csv file' using a 'xml_to_csv file.py'.
you have to check the file extension such as .jpg , .png , .jpeg
and then, containing file extension to image file name at the 'csv file'
for example.

image

finally, I can implement 'generate_tfrecord.py'

thanks, good luck to everyone

Oh, It also works for me, thank u !

I'm using Windows 10, Python 3.6.4 and Tensorflow 1.5. I get this problem too.
D:\develop\models\research>python object_detection\dataset_tools\create_pascal_tf_record.py --data_dir=D:\dataset\VOCdevkit\ --year=VOC2012 --set=train --output_path=D:\dataset\TFrecord\data\pascal_train.record
Traceback (most recent call last):
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 186, in
tf.app.run()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection\dataset_tools\create_pascal_tf_record.py", line 159, in main
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 137, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\develop\models\research\object_detection\utils\label_map_util.py", line 117, in load_labelmap
label_map_string = fid.read()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 119, in read
self._preread_check()
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\libio\file_io.py", line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Program FilesPython35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: D:\develop\modeesearch\object_detection\data\pascal_label_map3.pbtxt : \udcc0\u026e\u05e6W\udcba\u0661B\udca5\u063f\udcfd\udca6W\udcba\u0669κ\u03fa\u03fc\udcd0\udcc5\u04bby\udcaak\udcbf\udcf9\udcbb~\udca1C
; Unknown error

Were you able to solve it. I am facing the same issue

Hey, were you able to fix this? If so, please let me know how

I met the same question, and i watched this video which is mentioned above by LEESHACK .YouTube Video. in this video i noticed that when he entered the code at cmd, transfer the parameter to python, he follow this rule, for example what i did:
python run_classifier.py --task_name=MRPC --do_train=true --do_eval=true --data_dir=D:\glue\MRPC --vocab_file=D:BERT_uncased_L-12_H-768_A-12/vocab.txt --bert_config_file=D:BERT_uncased_L-12_H-768_A-12/bert_config.json --init_checkpoint=D:BERT_uncased_L-12_H-768_A-12/bert_model.ckpt --max_seq_length=128 --train_batch_size=8 --learning_rate=2e-5 --num_train_epochs=3.0 --output_dir=D:\output\tempPycharm
follow what i did, every detail, be careful about / and \ , can solve the problem.

notice, this problem only happen in Windows cmd, won't happen in Linux.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edwardHujber picture edwardHujber  ·  82Comments

10183308 picture 10183308  ·  50Comments

Hemanth2396 picture Hemanth2396  ·  60Comments

Tsuihao picture Tsuihao  ·  90Comments

wrkgm picture wrkgm  ·  78Comments