,當我運行我的代碼,我得到的錯誤是這樣的:tensorflow:蹊蹺的「tf.gfile.GFile」與「‘UTF-8’編解碼器不能解碼......」
File "data2record.py", line 120, in <module>
run()
File "data2record.py", line 114, in run
image_data, shape, bbox, label ,imname= _processing_image(wordbb, imname,coder)
File "data2record.py", line 64, in _processing_image
image_data = tf.gfile.GFile(FLAGS.datasets + imname, 'r').read()
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length, status))
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 93, in _prepare_value
return compat.as_str_any(val)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 106, in as_str_any
return as_str(value)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 84, in as_text
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
在我的代碼中的錯誤行是:
...
image_data = tf.gfile.GFile(FLAGS.datasets + imname, 'r').read()
image = coder.decode_jpeg(image_data)
...
我tensorflow是1.3和Python是3.5.And這個代碼可以在tensorflow 1.0運行,蟒蛇2.7.Why它不能在tensorflow運行是1.3和python是3.5? 代碼位於datasets/data2record.py中:https://github.com/xiaodiu2010/TextBoxes-TensorFlow 有人可以幫助我嗎?
很有效。非常感謝! –