0
votes
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)

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'

I know the resason of issue, its caused because of (import tensorflow.compat.v1 as tf) not compatble in 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.

Do i have to degrade the version from 2.0.* to 1.* or there is any solution to it that i am missing.

1

1 Answers

0
votes

Yes, downgrading to version 1.* is necessary. Glfile was removed in 2.0.