from utils import label_map_util Import Error: No module named utils

后端 未结 4 1422
轻奢々
轻奢々 2021-01-04 13:07

I am trying to run the object_detection.ipynb type program but it is a normal python program(.py). It is working very well but when running inside the ..m

相关标签:
4条回答
  • 2021-01-04 13:16

    in python*./site-packages folder , you can see the utils folder . by default , when we run "from utils import label_map_util" it will try search label_map_util in python.*/site-packages/utils folder.

    this error can solve by changing the directory or copying a file from tensorflow/models/utils to python*.*/site-packages/utils

    0 讨论(0)
  • 2021-01-04 13:24

    It could be that your object_detection folder is not on your path, so python does not know where to look for the files.

    you can check this from within python with

    import sys
    
    sys.path
    

    if this is the problem, you can solve it by

    sys.path.insert(0, 'path/to/your/object_detection')
    
    0 讨论(0)
  • 2021-01-04 13:25

    I have seen the same problem. that's because string_int_label_map_pb2.py file doesn't exist.

    1.you need to install protobuf.

    https://github.com/google/protobuf/releases
    
    1. cd your path to object_detection

      protoc object_detection/protos/string_int_label_map.proto --python_out=.

    you will find string_int_label_map_pb2.py file in 'object_detection\protos'

    1. that will be ok, if there is still a problem, you can add your object_detection folder to PYTHONPATH.
    0 讨论(0)
  • 2021-01-04 13:27

    You need to download protoc version 3.3 (already compiled). Used protoc inside bin directory to run this command like this:

    tensorflow$ mkdir protoc_3.3
    tensorflow$ cd protoc_3.3
    tensorflow/protoc_3.3$ wget wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
    tensorflow/protoc_3.3$ chmod 775 protoc-3.3.0-linux-x86_64.zip
    tensorflow/protoc_3.3$ unzip protoc-3.3.0-linux-x86_64.zip
    tensorflow/protoc_3.3$ cd ../models/research/
    tensorflow/protoc_3.3$ /home/saikishor/tensorflow/protoc_3.3/bin/protoc object_detection/protos/*.proto --python_out=.
    

    This will hopefully work!!

    0 讨论(0)
提交回复
热议问题