Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
148 views
in Technique[技术] by (71.8m points)

python - MacOS: ModuleNotFoundError: No module named 'object_detection'


!python {'/content/generate_tfrecord.py'} -x {'/content/Training'} -l {'/content/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'}
!python {'/content/generate_tfrecord.py'} -x{'/content/Testing'} -l {'/content/label_map.pbtxt'} -o {ANNOTATION_PATH + '/test.record'}

running which gives me the error:

Traceback (most recent call last):
  File "/content/generate_tfrecord.py", line 29, in <module>
    from object_detection.utils import dataset_util, label_map_util
ModuleNotFoundError: No module named 'object_detection'
Traceback (most recent call last):
  File "/content/generate_tfrecord.py", line 29, in <module>
    from object_detection.utils import dataset_util, label_map_util
ModuleNotFoundError: No module named 'object_detection'

MacOS Catalina 10.15.2, Tensorflow (latest version)

I have already installed all dependencies through pip. (object-detection api, exported the path in terminal, ran the command "python setup.py install in the same path)

Thank you!

question from:https://stackoverflow.com/questions/65680146/macos-modulenotfounderror-no-module-named-object-detection

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have compiled the proto files right.

export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research
export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research/object_detection
export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research/slim

After exporting, inside tensorflow/models/research you can run

python setup.py build
python setup.py install

It will work. I have tested it out on my mac os before.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...