models icon indicating copy to clipboard operation
models copied to clipboard

Unable to import from utils

Open Zumbalamambo opened this issue 9 years ago • 17 comments

Im trying to run object detection example. I ran jupyter notebook in object_detection directory. then I opened the notebook file. It is firing the following error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-7-956de605e8fe> in <module>()
----> 1 from utils import label_map_util
      2 
      3 from utils import visualization_utils as vis_util

C:\Users\Documents\models-master\models-master\object_detection\utils\label_map_util.py in <module>()
     20 import tensorflow as tf
     21 from google.protobuf import text_format
---> 22 from object_detection.protos import string_int_label_map_pb2
     23 
     24 

ImportError: cannot import name 'string_int_label_map_pb2'

Zumbalamambo avatar Jul 17 '17 08:07 Zumbalamambo

Did you build? There should be a file called string_int_label_map_pb2.py in your python path.

drpngx avatar Jul 17 '17 16:07 drpngx

No... i did not run that first... should I run it the first? Where do i find the build file?

Zumbalamambo avatar Jul 17 '17 16:07 Zumbalamambo

There is a build file in the main directory. You should try:

blaze build --config=opt :train

from the object_detection directory. /CC @derekjchow

drpngx avatar Jul 17 '17 17:07 drpngx

I think you should build .proto files first. Please follow the instruction here: https://github.com/tensorflow/models/blob/477ed41e7e4e8a8443bc633846eb01e2182dc68a/object_detection/g3doc/installation.md#protobuf-compilation

friskit-china avatar Jul 19 '17 14:07 friskit-china

may I know what is proto file and why do we need that?

Zumbalamambo avatar Jul 19 '17 16:07 Zumbalamambo

Tensorflow/models is a project with many experimental codes, which contains many .proto files. We have to compile them first to get .py files by a program named "protoc".

发件人:[email protected] 发送时间:2017年7月20日 上午12:24 收件人:[email protected] 回复:[email protected] 抄送:[email protected]; [email protected] 主题:Re: [tensorflow/models] Unable to import from utils (#1969)

may I know what is proto file and why do we need that?

― You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/tensorflow/models/issues/1969#issuecomment-316440899, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACYRo5s1l47J0apivnSjBks2LlpAlhfcks5sPi2rgaJpZM4OZszG.

friskit-china avatar Jul 19 '17 16:07 friskit-china

Okay It worked thanks...but i got the following error while executing eval.py

_sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval.py", line 135, in main
    assert FLAGS.checkpoint_dir, '`checkpoint_dir` is missing.'
AssertionError: `checkpoint_dir` is missing.

Zumbalamambo avatar Jul 19 '17 16:07 Zumbalamambo

May I know where do I get the checkpoint file for getting the detection as in this link

Zumbalamambo avatar Jul 19 '17 16:07 Zumbalamambo

It's not just the proto files. You need to follow the instructions to build the models.

Again, please use bazel to build.

drpngx avatar Jul 19 '17 17:07 drpngx

wow you are a genius.... thanks it worked. Thank you so much!!!...

by the way, Is it possible to get the pretrained model of tensorbox which I can use for detection of just the head? or is there any pretrained model that can detect the heads as in tensorbox?

Zumbalamambo avatar Jul 19 '17 17:07 Zumbalamambo

So I think you'd better follow the instructions I posted earlier.

发件人:[email protected] 发送时间:2017年7月20日 上午12:38 收件人:[email protected] 回复:[email protected] 抄送:[email protected]; [email protected] 主题:Re: [tensorflow/models] Unable to import from utils (#1969)

I got this error while executing it from the root folder (Models folder)

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/tensorflow/models/issues/1969#issuecomment-316444677, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACYRo9SLHftRbR8-sBTTGu7Rjk6sp5j_ks5sPjDlgaJpZM4OZszG.

friskit-china avatar Jul 19 '17 17:07 friskit-china

@Zumbalamambo Please follow the official installation instructions as pointed out by @friskit-china.

We don't officially support Bazel as a build system for the Tensorflow Object Detection API yet, but are considering adding it in the future.

derekjchow avatar Jul 19 '17 17:07 derekjchow

is it possible to simulate tensorbox in object detection api?

Zumbalamambo avatar Jul 19 '17 17:07 Zumbalamambo

@Zumbalamambo what is tensorbox?

derekjchow avatar Jul 19 '17 22:07 derekjchow

This is tensorbox.

Zumbalamambo avatar Jul 20 '17 01:07 Zumbalamambo

Closing this issue since the original error message was solved. Feel free to reopen if still running into issues and also provide additional information. Thanks!

ymodak avatar Oct 31 '18 20:10 ymodak

I have followed the install instructions and I have the same error.

Unable to import from utils

bigswede74 avatar Nov 21 '19 18:11 bigswede74