简体   繁体   English

OSError:SavedModel 文件不存在于:/content\model\2016/{saved_model.pbtxt|saved_model.pb}

[英]OSError: SavedModel file does not exist at: /content\model\2016/{saved_model.pbtxt|saved_model.pb}

I ran the code我跑了代码

export_path=os.getcwd()+'\\model\\'+'2016'

with tf.Session(graph=tf.Graph()) as sess:
    tf.saved_model.loader.load(sess, ["myTag"], export_path)          
    graph = tf.get_default_graph()
#    print(graph.get_operations())
    input = graph.get_tensor_by_name('input:0')
    output = graph.get_tensor_by_name('output:0')    
#     print(sess.run(output,
#                feed_dict={input: [test_data[1]]}))
    tf.train.write_graph(freeze_session(sess), export_path, "my_model.pb", as_text=False)

and incurred the following error并引发以下错误

OSError                                   Traceback (most recent call last)
<ipython-input-44-b154e11ca364> in <module>()
      3 
      4 with tf.Session(graph=tf.Graph()) as sess:
----> 5     tf.saved_model.loader.load(sess, ["myTag"], export_path)          
      6     graph = tf.get_default_graph()
      7 #    print(graph.get_operations())

3 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/saved_model/loader_impl.py in parse_saved_model(export_dir)
     81                   (export_dir,
     82                    constants.SAVED_MODEL_FILENAME_PBTXT,
---> 83                    constants.SAVED_MODEL_FILENAME_PB))
     84 
     85 

OSError: SavedModel file does not exist at: /content\model\2016/{saved_model.pbtxt|saved_model.pb}

It was previously ran in Windows system and now IOS.它以前在 Windows 系统中运行,现在在 IOS 系统中运行。 I am not sure if it was because of this.我不确定是不是因为这个。 Any help is appreciated.任何帮助表示赞赏。 Thank you.谢谢你。

You should avoid using a fixed character as directory separator (like \ in your example), as that character differs between operating systems (see os.sep ).您应该避免使用固定字符作为目录分隔符(如示例中的\ ),因为该字符在操作系统之间有所不同(请参阅os.sep )。 You might want to use os.path.join or Path to build your path, thereby ensuring suitable paths for the executing operating system are created, eg:您可能希望使用os.path.joinPath来构建您的路径,从而确保为正在执行的操作系统创建合适的路径,例如:

export_path = os.path.join(os.getcwd(), 'model', '2016')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OSError:SavedModel 文件不存在于:cnnCat2.h5\{saved_model.pbtxt|saved_model.pb} - OSError: SavedModel file does not exist at: cnnCat2.h5\{saved_model.pbtxt|saved_model.pb} OSError:SavedModel 文件不存在于:model/CPN_Model.h5\{saved_model.pbtxt|saved_model.pb} - OSError: SavedModel file does not exist at: model/CPN_Model.h5\{saved_model.pbtxt|saved_model.pb} OSError:SavedModel 文件不存在于:model\mymodel.h5/{saved_model.pbtxt|saved_model.pb} - OSError: SavedModel file does not exist at: model\mymodel.h5/{saved_model.pbtxt|saved_model.pb} OSError:SavedModel 文件不存在于:../dnn/mpg_model.h5/{saved_model.pbtxt|saved_model.pb} - OSError: SavedModel file does not exist at: ../dnn/mpg_model.h5/{saved_model.pbtxt|saved_model.pb} OSError:SavedModel 文件不存在于:C:\Users\Munib\New folder/{saved_model.pbtxt|saved_model.pb} - OSError: SavedModel file does not exist at: C:\Users\Munib\New folder/{saved_model.pbtxt|saved_model.pb} SavedModel 文件不存在于:model.h5/{saved_model.pbtxt|saved_model.pb} - SavedModel file does not exist at: model.h5/{saved_model.pbtxt|saved_model.pb} 腌制文件存在但其中没有任何内容 OSError:SavedModel 文件不存在于:{saved_model.pbtxt|saved_model.pb} - a pickled file exists but nothing in it OSError: SavedModel file does not exist at: {saved_model.pbtxt|saved_model.pb} OSError:SavedModel 文件不存在于:C:/User/A/model/saved_model.pb - OSError: SavedModel file does not exist at: C:/User/A/model/saved_model.pb FAILED_PRECONDITION:错误:SavedModel目录gs:// mybucket1 /应该完全包含[saved_model.pb,saved_model.pbtxt]中的一个 - FAILED_PRECONDITION: Error: SavedModel directory gs://mybucket1/ is expected contain exactly one of [saved_model.pb, saved_model.pbtxt] 如何正确创建saved_model.pb? - How to correctly create saved_model.pb?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM