我在Linux上使用tensorflow 2.0,python 3.7。我正在尝试从以下存储库中运行对象检测教程代码: https://github.com/tensorflow/models/tree/master/research/object_detection
下面提供了引发错误的代码块。
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.compat.v1.GraphDef()
with tf.compat.v2.io.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='')
category_index = label_map_util.create_category_index_from_labelmap(PATH_TO_LABELS, use_display_name=True)
如果我运行最后一行,则显示标题中提到的错误。请提供解决方案
编辑:添加了问题的屏幕截图enter image description here