Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when generate tfrecord #41

Open
BraveGump opened this issue Feb 26, 2018 · 15 comments
Open

error when generate tfrecord #41

BraveGump opened this issue Feb 26, 2018 · 15 comments

Comments

@BraveGump
Copy link

when I run generate_tfrecord. I met the problem below:
Traceback (most recent call last):
File "generate_tfrecord.py", line 99, in
tf.app.run()
File "D:\python\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "generate_tfrecord.py", line 85, in main
writer = tf.python_io.TFRecordWriter(FLAGS.output_path)
File "D:\python\lib\site-packages\tensorflow\python\lib\io\tf_record.py", line 106, in init
compat.as_bytes(path), compat.as_bytes(compression_type), status)
File "D:\python\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a NewWriteableFile: : The system cannot find the path specified.
; No such process
how can i fix it?

@thriskel
Copy link

check spaces in the input/output path, it's telling you that the path doesn't exist.

@BraveGump
Copy link
Author

@thriskel Thank u for your remind.

@chandanmono
Copy link

D:\Mainproject\models-master\research\object_detection>python generate_tfrecord.py
Traceback (most recent call last):
File "generate_tfrecord.py", line 99, in
tf.app.run()
File "C:\Users\Chandan\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "generate_tfrecord.py", line 85, in main
writer = tf.python_io.TFRecordWriter(FLAGS.output_path)
File "C:\Users\Chandan\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\tf_record.py", line 111, in init
compat.as_bytes(path), compat.as_bytes(compression_type), status)
File "C:\Users\Chandan\AppData\Local\Programs\Python\Python35\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.NotFoundError: Failed to create a NewWriteableFile: : The system cannot find the path specified.
; No such process

can someone tell where and what has to be changed ?
Thank you.. @BraveGump @thriskel

@Zoe3542188
Copy link

same error as @BraveGump
did you fix it?

@pc2005
Copy link

pc2005 commented Mar 7, 2019

I ran into the same issue and resolved it by:

  1. Make sure to check out tensorflow models and set your environment variable PYTHONPATH correctly:
    export PYTHONPATH=$PYTHONPATH:<path_to_tensorflow>/models/research/:<path_to_tensorflow>/models/research/slim

  2. Run the script with proper parameters/flags:
    python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path = train.record --image_dir=images/

@Youzhenwan
Copy link

(tfgpu) D:\models\research\object_detection>python generate_TFR.py --csv_input=d
ata/test0.csv --output_path=train.record
Traceback (most recent call last):
File "generate_TFR.py", line 112, in
tf.app.run()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\platform\app.
py", line 125, in run
_sys.exit(main(argv))
File "generate_TFR.py", line 103, in main
tf_example = create_tf_example(group, path)
File "generate_TFR.py", line 58, in create_tf_example
encoded_jpg = fid.read()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 125, in read
self._preread_check()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\framework\err
ors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFil
e failed to Create/Open: D:\models\research\object_detection\images2 rain\tra
in_0.png : \udcceļ\udcfe\udcc3\udcfb\udca1\udca2Ŀ¼\udcc3\udcfb\udcbb\udcf2\udcbe
\udced\udcb1\udcea\udcd3�\udcb2\udcbb\udcd5\udcfdȷ\udca1\udca3
; Unknown error

How can I fix it?

@Youzhenwan
Copy link

(tfgpu) D:\models\research\object_detection>python generate_TFR.py --csv_input=d
ata/test0.csv --output_path=train.record
Traceback (most recent call last):
File "generate_TFR.py", line 112, in
tf.app.run()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\platform\app.
py", line 125, in run
_sys.exit(main(argv))
File "generate_TFR.py", line 103, in main
tf_example = create_tf_example(group, path)
File "generate_TFR.py", line 58, in create_tf_example
encoded_jpg = fid.read()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 125, in read
self._preread_check()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\framework\err
ors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFil
e failed to Create/Open: D:\models\research\object_detection\images2 rain\tra
in_0.png : \udcceļ\udcfe\udcc3\udcfb\udca1\udca2Ŀ¼\udcc3\udcfb\udcbb\udcf2\udcbe
\udced\udcb1\udcea\udcd3�\udcb2\udcbb\udcd5\udcfdȷ\udca1\udca3
; Unknown error

How can I fix it?

(tfgpu) D:\models\research\object_detection>python generate_TFR.py --csv_input=d
ata/test0.csv --output_path=train.record
Traceback (most recent call last):
File "generate_TFR.py", line 112, in
tf.app.run()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\platform\app.
py", line 125, in run
_sys.exit(main(argv))
File "generate_TFR.py", line 103, in main
tf_example = create_tf_example(group, path)
File "generate_TFR.py", line 58, in create_tf_example
encoded_jpg = fid.read()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 125, in read
self._preread_check()
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\lib\io\file_i
o.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "D:\Anaconda\envs\tfgpu\lib\site-packages\tensorflow\python\framework\err
ors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFil
e failed to Create/Open: D:\models\research\object_detection\images2 rain\tra
in_0.png : \udcceļ\udcfe\udcc3\udcfb\udca1\udca2Ŀ¼\udcc3\udcfb\udcbb\udcf2\udcbe
\udced\udcb1\udcea\udcd3�\udcb2\udcbb\udcd5\udcfdȷ\udca1\udca3
; Unknown error

How can I fix it?

em,it's my problem...I have fix it.

@dongyong1996
Copy link

(tfgpu)D:\ models \ research \ object_detection> python generate_TFR.py --csv_input = d
ata / test0.csv --output_path = train.record
Traceback(最近一次调用最后一次):
文件“generate_TFR.py”,第112行,在
tf.app.run()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ platform \ app.py
”,第125行,在运行
sys.exit中(main(argv) )
文件“generate_TFR.py”,第103行,在主
tf_example = create_tf_example(group,path)
文件“generate_TFR.py”,第58行,在create_tf_example
encoded_jpg = fid.read()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ lib \ io \ file_i
o.py“,第125行,读取
self.preread_check()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ lib \ io \ file_i
o.py”,第85行,在_preread_check
compat.as_bytes(self .
name),1024 * 512,status )
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ framework \ err
ors_impl.py”,第528行,在退出
c_api.TF_GetCode(self.status.status)中)
tensorflow.python。 framework.errors_impl.InvalidArgumentError:NewRandomAccessFil
e无法创建/打开:D:\ models \ research \ object_detection \ images2 rain \ tra
in_0.png:\udcceļ\ udcfe \ udcc3 \ udcfb \ udca1 \udca2Ŀ¼\ udcc3 \ udcfb \ udcbb \ udcf2 \ udcbe
\ udced \ udcb1 \ udcea \udcd3 \ udcb2 \ udcbb \ udcd5 \udcfdȷ\ udca1 \ udca3
; 未知错误
我该如何解决?

(tfgpu)D:\ models \ research \ object_detection> python generate_TFR.py --csv_input = d
ata / test0.csv --output_path = train.record
Traceback(最近一次调用最后一次):
文件“generate_TFR.py”,第112行,在
tf.app.run()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ platform \ app.py
”,第125行,在运行
sys.exit中(main(argv) )
文件“generate_TFR.py”,第103行,在主
tf_example = create_tf_example(group,path)
文件“generate_TFR.py”,第58行,在create_tf_example
encoded_jpg = fid.read()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ lib \ io \ file_i
o.py“,第125行,读取
self.preread_check()
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ lib \ io \ file_i
o.py”,第85行,在_preread_check
compat.as_bytes(self .
name),1024 * 512,status )
文件“D:\ Anaconda \ envs \ tfgpu \ lib \ site-packages \ tensorflow \ python \ framework \ err
ors_impl.py”,第528行,在退出
c_api.TF_GetCode(self.status.status)中)
tensorflow.python。 framework.errors_impl.InvalidArgumentError:NewRandomAccessFil
e无法创建/打开:D:\ models \ research \ object_detection \ images2 rain \ tra
in_0.png:\udcceļ\ udcfe \ udcc3 \ udcfb \ udca1 \udca2Ŀ¼\ udcc3 \ udcfb \ udcbb \ udcf2 \ udcbe
\ udced \ udcb1 \ udcea \udcd3 \ udcb2 \ udcbb \ udcd5 \udcfdȷ\ udca1 \ udca3
; 未知错误
我该如何解决?

嗯,这是我的问题......我已经解决了。

How did you solve it?Thank you!(请问你是怎样解决的,谢谢!)

@Azatick94
Copy link

I ran into the same issue and resolved it by:

  1. Make sure to check out tensorflow models and set your environment variable PYTHONPATH correctly:
    export PYTHONPATH=$PYTHONPATH:<path_to_tensorflow>/models/research/:<path_to_tensorflow>/models/research/slim
  2. Run the script with proper parameters/flags:
    python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path = train.record --image_dir=images/

Thank you pc2005. I had the same issue and your instructions helped me.

@Aniket1492
Copy link

try to run using command line : python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record --image_dir=./images

@etatbak
Copy link

etatbak commented Jul 26, 2019

For windows you need to run this code in Research folder
on cmd: SET PYTHONPATH=%cd%;%cd%\slim

@vinayslone1995
Copy link

vinay@vinay-Lenovo-G50-70:~/models/research/object_detection$ python generate_tfrecord.py --csv_input=image/train_labels.csv --image_dir=image/train --output_path=train.record
WARNING: Logging before flag parsing goes to stderr.
W0812 19:07:55.100965 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:106: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

W0812 19:07:55.103269 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:92: The name tf.python_io.TFRecordWriter is deprecated. Please use tf.io.TFRecordWriter instead.

W0812 19:07:55.232243 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:51: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Traceback (most recent call last):
File "generate_tfrecord.py", line 106, in
tf.app.run()
File "/home/vinay/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/vinay/.local/lib/python2.7/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/home/vinay/.local/lib/python2.7/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "generate_tfrecord.py", line 97, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 86, in create_tf_example
'image/object/class/label': dataset_util.int64_list_feature(classes),
File "/usr/local/lib/python2.7/dist-packages/object_detection-0.1-py2.7.egg/object_detection/utils/dataset_util.py", line 30, in int64_list_feature
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
TypeError: None has type NoneType, but expected one of: int, long

i am getting this error while executing tf_record.py

@poojanair96
Copy link

vinay@vinay-Lenovo-G50-70:~/models/research/object_detection$ python generate_tfrecord.py --csv_input=image/train_labels.csv --image_dir=image/train --output_path=train.record
WARNING: Logging before flag parsing goes to stderr.
W0812 19:07:55.100965 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:106: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

W0812 19:07:55.103269 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:92: The name tf.python_io.TFRecordWriter is deprecated. Please use tf.io.TFRecordWriter instead.

W0812 19:07:55.232243 140015557965632 deprecation_wrapper.py:119] From generate_tfrecord.py:51: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Traceback (most recent call last):
File "generate_tfrecord.py", line 106, in
tf.app.run()
File "/home/vinay/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/vinay/.local/lib/python2.7/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/home/vinay/.local/lib/python2.7/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "generate_tfrecord.py", line 97, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 86, in create_tf_example
'image/object/class/label': dataset_util.int64_list_feature(classes),
File "/usr/local/lib/python2.7/dist-packages/object_detection-0.1-py2.7.egg/object_detection/utils/dataset_util.py", line 30, in int64_list_feature
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
TypeError: None has type NoneType, but expected one of: int, long

i am getting this error while executing tf_record.py

same error @vinayslone1995 did you get it rectified??

@mishank26
Copy link

C:\Mayur\Facemask>python generate_tfrecord.py [-x images] [-l annotations] [-o records] [-i images] [-c data]
2020-09-11 13:51:29.341914: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-09-11 13:51:29.345204: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "generate_tfrecord.py", line 120, in
tf.compat.v1.app.run()
File "C:\Users\HBH TECHNOLOGIES\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\HBH TECHNOLOGIES\AppData\Roaming\Python\Python38\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "C:\Users\HBH TECHNOLOGIES\AppData\Roaming\Python\Python38\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "generate_tfrecord.py", line 106, in main
writer = tf.compat.v1.python_io.TFRecordWriter(FLAGS.output_path)
File "C:\Users\HBH TECHNOLOGIES\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\lib\io\tf_record.py", line 298, in init
super(TFRecordWriter, self).init(
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a NewWriteableFile: : The system cannot find the path specified.
; No such process

@arkp1612
Copy link

I am trying to read a tfrecord file and get this error NewRandomAccessFile failed to Create/Open: 'path to file'<TFRecordDatasetV2 shapes: (), types: tf.string> : The filename, directory name, or volume label syntax is incorrect.
; no protocol option

The path to the tfrecord file seems to be correct, can anyone help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests