python-3.x - 错误: Module 'tensorflow' has no attribute 'gfile' error while running tensorflow object detection api tutorial

标签 python-3.x tensorflow

我正在尝试使用 tensorflow api中的对象检测教程。我正在使用python 3和 tensorflow 版本2。但是遇到以下错误。我尝试了几种方法:

File "C:\Aniruddhya\object_detection\object_detection\utils\label_map_util.py", line 137, in load_labelmap
    with tf.gfile.GFile(path, 'r') as fid:

AttributeError: module 'tensorflow' has no attribute 'gfile'

有人可以帮我运行吗?
代码链接:https://drive.google.com/drive/u/3/folders/1XHpnr5rsENzOOSzoWNTvRqhEbLKXaenL

最佳答案

在TensorFlow 2中没有这样称呼。您可能正在使用TensorFlow 1教程。

版本1tf.gfile.GFile https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/io/gfile/GFile

版本2tf.io.gfile.GFile https://www.tensorflow.org/api_docs/python/tf/io/gfile/GFile

关于python-3.x - 错误: Module 'tensorflow' has no attribute 'gfile' error while running tensorflow object detection api tutorial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58363136/

相关文章:

python-3.x - 将输入写入文件,不包括最后一行

python - LSTM 在预测和基本事实之间具有系统偏移

python - GRU加载模型错误,ValueError : GRU(reset_after=False) is not compatible with GRU(reset_after=True)

python - 批处理文件中的空白并搁置保存在不同的目录中

python - 计算 pandas df 中的非空值

python - 无法设置 pygame.Color 的 hsva/hsla 属性

tensorflow - 如何编译 TensorFlow 二进制文件以使用 AVX2、AVX512F、FMA?

python - 在 csv 文件中查找每个月的最高温度?

tensorflow - LSTM 在预训练的 CNN 之上

python - 如何使用node_def复制Tensorflow中的图操作?