简体   繁体   English

label_map_util.load_labelmap 错误:模块“tensorflow”没有属性“gfile”

[英]label_map_util.load_labelmap Error: module 'tensorflow' has no attribute 'gfile'

label_map = label_map_util.load_labelmap(PATH_TO_LABELS)

AttributeError Traceback (most recent call last) in ----> 1 label_map = label_map_util.load_labelmap(PATH_TO_LABELS) 2 categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True) 3 category_index = label_map_util.create_category_index(categories) ----> 1 label_map = label_map_util.load_labelmap(PATH_TO_LABELS) 2 category = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True) 3map category_index.(PATH_TO_LABELS)

c:\\ML\\od\\models\\research\\object_detection\\utils\\label_map_util.py in load_labelmap(path) 136 a StringIntLabelMapProto 137 """ --> 138 with tf.gfile.GFile(path, 'r') as fid: 139 label_map_string = fid.read() 140 label_map = string_int_label_map_pb2.StringIntLabelMap() c:\\ML\\od\\models\\research\\object_detection\\utils\\label_map_util.py in load_labelmap(path) 136 a StringIntLabelMapProto 137 """ --> 138 with tf.gfile.GFile(path, 'r') as fid: 139 label_map_string = fid.read() 140 label_map = string_int_label_map_pb2.StringIntLabelMap()

AttributeError: module 'tensorflow' has no attribute 'gfile' AttributeError: 模块“tensorflow”没有属性“gfile”

I know the resason of issue, its caused because of ( import tensorflow.compat.v1 as tf ) not compatble in 2.0.0.我知道问题的原因,它是由于( import tensorflow.compat.v1 as tf )在 2.0.0 中不兼容造成的。 I solved it this issue using import tensorflow.compat.v1 as tf in my custom code, but the issue is coming from label_map_util which is inside model/research/object_detection/utils.我在我的自定义代码中使用import tensorflow.compat.v1 as tf解决了这个问题,但问题来自位于 model/research/object_detection/utils 中的 label_map_util。

Do i have to degrade the version from 2.0.* to 1.* or there is any solution to it that i am missing.我是否必须将版本从 2.0.* 降级到 1.* 或者有任何我缺少的解决方案。

Yes, downgrading to version 1.* is necessary.是的,必须降级到版本 1.*。 Glfile was removed in 2.0. Glfile 在 2.0 中被删除。

暂无
暂无

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

相关问题 TensorFlow2.0.0 Alpha-模块'tensorflow'没有属性'gfile' - TensorFlow2.0.0 Alpha- module 'tensorflow' has no attribute 'gfile' AttributeError:模块'tensorflow'没有属性'gfile'Tensorflow 2.8.2 - AttributeError: module 'tensorflow' has no attribute 'gfile' Tensorflow 2.8.2 AttributeError:即使在第 131 行将 tf.gfile.* 更改为 tf.io.gfile.*,模块“tensorflow”也没有属性“gfile” - AttributeError: module 'tensorflow' has no attribute 'gfile' even when changed tf.gfile.* to tf.io.gfile.* in line 131 仍然得到 AttributeError: module 'tensorflow' has no attribute 'gfile' 在尝试了每件事来解决这个问题之后 - Still getting AttributeError: module 'tensorflow' has no attribute 'gfile' after trying every thing to solve that 为什么 Tensorflow 即使在我更改文件后也没有属性“gfile”? - Why Tensorflow has no attribute 'gfile' even after I changed the file? AttributeError:模块“tensorflow”没有属性“app”:错误 - AttributeError: module 'tensorflow' has no attribute 'app': error tensorflow 错误:模块没有属性 GraphDef - tensorflow error: module has no attribute GraphDef 属性错误:模块“tensorflow”没有属性“变量”“错误” - AttributeError: module 'tensorflow' has no attribute 'Variable' “ERROR” 模块“importlib”没有属性“util” - module 'importlib' has no attribute 'util' Tensorflow 2.1.0 错误,模块“tensorflow”没有属性“GraphKeys” - Tensorflow 2.1.0 Error, module 'tensorflow' has no attribute 'GraphKeys'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM