【问题标题】:Error in Load a (frozen) Tensorflow model into memory将(冻结的)Tensorflow 模型加载到内存中时出错
【发布时间】: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


    【解决方案1】:

    您的问题将分为两部分。第一部分是检测图像中的车牌,第二部分是识别车牌上的字符。您可以在 Kaggle 或 UCI 存储库等数据存储库上轻松找到这两种情况的数据集。 CNN 模型将遍历汽车的图像,直到找到车牌。找到车牌后,模型将遍历车牌以读取字符。

    Stackoverflow 不适合回答这个问题,因为我们无法在不了解您的数据集的情况下为您提供任何模型架构,因此请查看 this 等在线资源。

    【讨论】:

      猜你喜欢
      • 2018-11-08
      • 2019-01-04
      • 2020-02-14
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      • 2018-02-23
      • 1970-01-01
      • 2018-10-27
      相关资源
      最近更新 更多