machine learning - Tensorflow: has no attribute 'load_labelmap' -


i followed steps described on github install object detection api , ran script:

python object_detection/builders/model_builder_test.py 

and test successful, assumed setup correctly. next tried run jupyter notebook qtconsole detect objects in test images. returns error:

attributeerror                            traceback (most recent call last) <ipython-input-3-be6fe1ba8733> in <module>() ----> 1 utils import label_map_util       2        3 utils import visualization_utils vis_util       4   ~\desktop\objectdetection\models-master\object_detection\utils\label_map_util.py in <module>()      20 import tensorflow tf      21 google.protobuf import text_format ---> 22 object_detection.protos import string_int_label_map_pb2      23       24   ~\desktop\objectdetection\models-master\object_detection\object_detection.py in <module>()     114      115  --> 116 label_map = label_map_util.load_labelmap(path_to_labels)     117 categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=num_classes, use_display_name=true)     118 category_index = label_map_util.create_category_index(categories)  attributeerror: module 'utils.label_map_util' has no attribute 'load_labelmap' 

does have idea cause of problem is?

thanks.

in file ~\desktop\objectdetection\models-master\object_detection\utils\label_map_util.py

try changing this:

from object_detection.protos import string_int_label_map_pb2

to this:

from protos import string_int_label_map_pb2

explanation:

the function load_labelmap in module label_map_util isn't accessible because import of string_int_label_map_pb2 failing.

you can see if @ output of print(dir(label_map_util)).

when using object_detection.protos:

['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'logging', 'text_format', 'tf']

after changing relative path protos function should accessible:

['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_validate_label_map', 'convert_label_map_to_categories', 'create_category_index', 'get_label_map_dict', 'load_labelmap', 'logging', 'string_int_label_map_pb2', 'text_format', 'tf']


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -