0

I got this error when I ran the notebook on jupyter.

enter image description here

log_dir = "inception_log"
if not os.path.exists(log_dir):
    os.makedirs(log_dir)

#classify_image_graph_def.pd是google訓練好的模型
inception_graph_def_file = os.path.join("inception_model","classify_image_graph_def.pd")
with tf.Session() as sess:
    #建一張圖存放google訓練好的模型
    with tf.gfile.FastGFile(inception_graph_def_file,'rb') as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
        tf.import_graph_def(graph_def,name = "")
    #保存圖的結構
    print("start")
    writer = tf.summary.FileWriter("inception_log",sess.graph)
    writer.close()
    print("end")

I'm not sure is this error cause I couldn't write a file in my folder. I tried to google this error but didn't find the way to solve this error. Thanks.

Community
  • 1
  • 1
YuJingYu
  • 19
  • 1
  • 9
  • What is the `repr(s)` of the entire string that the call to encode fails on? The character alone encodes: `u"\udca8".encode('utf-8')` => `'\xed\xb2\xa8'` – Dan D. Apr 18 '18 at 14:40
  • Possible duplicate of [Python 3: os.walk() file paths UnicodeEncodeError: 'utf-8' codec can't encode: surrogates not allowed](https://stackoverflow.com/questions/27366479/python-3-os-walk-file-paths-unicodeencodeerror-utf-8-codec-cant-encode-s) – Taku Apr 18 '18 at 14:41
  • @abccd I read the page you linked but I still don't understand.Can u explain for me?`inception_graph_def_file = os.path.join("inception_model","classify_image_graph_def.pd") new = inception_graph_def_file.encode("utf-8", "surrogateescape")` – YuJingYu Apr 19 '18 at 04:27

0 Answers0