什么是';tensorflow';没有属性';GraphDef';使用Tensorflow 2.0.0版?

什么是';tensorflow';没有属性';GraphDef';使用Tensorflow 2.0.0版?,tensorflow,machine-learning,object-detection,Tensorflow,Machine Learning,Object Detection,在我正在开发的对象检测应用程序中,我正在使用以下功能 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(ser

在我正在开发的对象检测应用程序中,我正在使用以下功能

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回溯(最近一次调用)
在里面
1检测图=tf.graph()
2带有检测图。作为默认值():
---->3 od_graph_def=tf.GraphDef()
4将tf.gfile.gfile(路径到冻结图,'rb')作为fid:
5序列化的_图=fid.read()
AttributeError:模块“tensorflow”没有属性“GraphDef”
我使用的是TensorFlow 2.0.0。这是否与版本不匹配有关


此代码来自以下内容。

是的,这是一个版本不匹配的问题,您不应该盲目地假设每个库都支持TensorFlow 2.0,这是最近才发布的


如果某个库没有公布对TensorFlow 2.0的明确支持,那么您应该将其与TensorFlow 1.x一起使用,确保已按照链接中的说明正确安装库

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