【发布时间】:2019-11-20 09:08:16
【问题描述】:
我正在使用 tensorflow 对象识别 API。我找不到任何解决方案。请帮助我。
我的代码是
MODEL_NAME = 'inference_graph'
PATH_TO_FROZEN_GRAPH = MODEL_NAME + '/frozen_inference_graph.pb'
PATH_TO_LABELS = 'training/labelmap.pbtxt'
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_FROZEN_GRAPH, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
显示错误
<ipython-input-10-d55b98fd5a78> in <module>
3 od_graph_def = tf.GraphDef()
4 with tf.gfile.GFile(PATH_TO_FROZEN_GRAPH, 'rb') as fid:
----> 5 serialized_graph = fid.read()
6 od_graph_def.ParseFromString(serialized_graph)
7 tf.import_graph_def(od_graph_def, name='')
~\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py in
read(self, n)
123 string if in string (regular) mode.
124 """
--> 125 self._preread_check()
126 with errors.raise_exception_on_not_ok_status() as status:
127 if n == -1:
~\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py in
_preread_check(self)
83 with errors.raise_exception_on_not_ok_status() as status:
84 self._read_buf = pywrap_tensorflow.CreateBufferedInputStream(
---> 85 compat.as_bytes(self.__name), 1024 * 512, status)
86
87 def _prewrite_check(self):
~\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py
in __exit__(self, type_arg, value_arg, traceback_arg)
526 None, None,
527 compat.as_text(c_api.TF_Message(self.status.status)),
--> 528 c_api.TF_GetCode(self.status.status))
529 # Delete the underlying status object from memory otherwise it
stays alive
530 # as there is a reference to status from this from the traceback
due to
NotFoundError: NewRandomAccessFile failed to Create/Open:
inference_graph/frozen_inference_graph.pb : The system cannot find the
path specified.
; No such process
inference_graph/frozen_inference_graph.pb中存在文件目录,但是为什么会出现这个错误?
【问题讨论】:
标签: python tensorflow machine-learning anaconda