caicloud / tensorflow-tutorial

Example TensorFlow codes and Caicloud TensorFlow as a Service dev environment.
2.93k stars 2.08k forks source link

第六章迁移学习中读取inception-v3模型的问题 #27

Closed skx300 closed 7 years ago

skx300 commented 7 years ago
with gfile.FastGFile(os.path.join(MODEL_DIR, MODEL_FILE), 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())

以上代码是读取inception-v3的模型时raise error的代码行,在sublime中我会收到以下错误: tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: 代码资源/Deep_Learning_with_TensorFlow/datasets/inception_dec_2015\tensorflow_inception_graph.pb : ϵͳ\udcd5Ҳ\udcbb\udcb5\udcbdָ\udcb6\udca8\udcb5\udcc4·\udcbe\udcb6\udca1\udca3

但是在spyder中,我得到的是以下的错误: UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd5' in position 2463: surrogates not allowed

请问是字符转换的问题吗?如何解决 这个问题呢?

OS: windows 7 Python: 3,5,2 Tensorflow: 1.0.1

skx300 commented 7 years ago

问题已经解决:读取的路径中有中文。如果路径中全部是英文的话,就没有问题。应该是跟windows有关。如果换成relative path的话也可以解决。