简体   繁体   English

Tensorflow 1.15 没有加载冻结图,过去一周给了我同样的错误

[英]Tensorflow 1.15 is not loading frozen graph, and has given me the same error for the past week

Okay, so I'm working on a large project in Google Colab, where I have to detect a certain object from all the others.好的,所以我正在 Google Colab 的一个大型项目中工作,我必须从所有其他项目中检测到某个 object。

Now, for the better half of the past week, I've been working tirelessly trying to get the graph to load, but oh my goodness.... nothing seems to be working.现在,在过去一周的大部分时间里,我一直在不知疲倦地工作试图让图表加载,但是我的天哪.... 似乎没有任何工作。

So, the block of code that I'm having trouble with is:所以,我遇到问题的代码块是:

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='')

The error arises in the last line.错误出现在最后一行。 For some reason, it says: NotFoundError: Op type not registered 'TFLite_Detection_PostProcess' in binary running on e32766609f28. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (eg) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.出于某种原因,它说: NotFoundError: Op type not registered 'TFLite_Detection_PostProcess' in binary running on e32766609f28. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (eg) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed. NotFoundError: Op type not registered 'TFLite_Detection_PostProcess' in binary running on e32766609f28. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (eg) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.

Also, I just wanna add that the PATH_TO_FROZEN_GRAPH is: /content/ssd_mobilenet_v3_small_coco_2020_01_14/frozen_inference_graph.pb .另外,我只想补充一点 PATH_TO_FROZEN_GRAPH 是: /content/ssd_mobilenet_v3_small_coco_2020_01_14/frozen_inference_graph.pb I can see the file there as well.我也可以在那里看到文件。 So, I don't know what the problem is.所以,我不知道问题是什么。

Are there any solutions?有什么解决办法吗? Thank you!谢谢!

TFLite_Detection_PostProcess is included by default in newer TFLite versions like 2.3.0 or 2.4.0. TFLite_Detection_PostProcess 默认包含在较新的 TFLite 版本(如 2.3.0 或 2.4.0)中。 Could you try those version?你能试试那个版本吗?

Otherwise, you have to add it to the TFLite interpreter.否则,您必须将其添加到 TFLite 解释器。 The way to do that depend on what language you are using.执行此操作的方法取决于您使用的语言。 Please see https://www.tensorflow.org/lite/guide/ops_custom#register_the_operator_with_the_kernel_library请参阅https://www.tensorflow.org/lite/guide/ops_custom#register_the_operator_with_the_kernel_library

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM