在TensorFlow 2.0.0版本中,为什么’tensorflow’模块没有’GraphDef’属性?

我在开发对象检测应用程序时使用了以下函数

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

当我运行这段代码时,出现了以下错误:


AttributeError                            Traceback (most recent call last)<ipython-input-6-d55b98fd5a78> in <module>      1 detection_graph = tf.Graph()      2 with detection_graph.as_default():----> 3   od_graph_def = tf.GraphDef()      4   with tf.gfile.GFile(PATH_TO_FROZEN_GRAPH, 'rb') as fid:      5     serialized_graph = fid.read()AttributeError: module 'tensorflow' has no attribute 'GraphDef'

我使用的是TensorFlow 2.0.0版本。这是否与版本不匹配有关?

这段代码来自以下链接


回答:

请确保你按照链接中给出的说明正确安装了库,

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注