前提・実現したいこと
Python3.6.4でTensorFlowのobject_detectionをやろうとしているのですが、TFRecordの作成時にエラーが出てしまいます。
タイトルの通り、Tensorflow.python_io.TFRecordWriterの実行時にエラーが出ているようです。
発生している問題・エラーメッセージ
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Program Files\Python36\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 "C:\Program Files\Python36\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.UnknownError: Failed to create a NewWriteableFile: C://file : \udc83A\udc83N\udc 83Z\udc83X\udc82\udcaa\udc8b\udc91\udc94ۂ\udcb3\udc82\udcea\udc82܂\udcb5\udc82\udcbd\udc81B ; Input/output error
該当のソースコード
python
1import os 2import tensorflow as tf 3from object_detection.utils import dataset_util 4 5flags = tf.app.flags 6flags.DEFINE_string('output_path', '', 'Path to output TFRecord') 7flags.DEFINE_string('input_path', '', 'Path to input xml') 8FLAGS = flags.FLAGS 9 10def main(_): 11 writer = tf.python_io.TFRecordWriter(FLAGS.output_path) 12 for files in os.listdir(FLAGS.input_path): 13 if os.path.splitext(files)[1] == '.xml': 14 tf_example = create_tf_example(files) 15 writer.write(tf_example.SerializeToString()) 16 17 writer.close() 18
試したこと
○コマンドプロンプトからPythonのコードを一行ずつ実行してみました。
・import tensorflow
→TFRecordWriter('C://folder/')
を実行でエラー
○TFRecordWriterの引数であるフォルダーパスが問題なのかと思い、以下を試しました。
・文字列をシングルクォーテーション、ダブルクォーテーションで囲む
→例: 'C://folder'
"C://folder"
・最後にも区切り文字を入れる
→例: 'C://folder/'
・ディレクトリの区切り文字をバックスラッシュにする
→例: 'C:\folder\'
・ディレクトリの位置を変える
→例: 'C://users/user/desktop/folder/'
・直接文字列を指定する
→例: writer = tf.python_io.TFRecordWriter('C://folder/')
補足情報(FW/ツールのバージョンなど)
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
tensorflow Version 1.5.0
Windows7 Pro 64bits
あなたの回答
tips
プレビュー