Tensorflow ImportError: cannot import name 'model_lib_v2' from 'object_detection'

Viewed 2290

Today I was working on a sign language detector using deep learning by Tensorflow

And by following the tutorial named Training Custom Object Detector but as soon as I get to the training stage it gives me this Error saying

Traceback (most recent call last):
  File "model_main_tf2.py", line 32, in <module>
    from object_detection import model_lib_v2
ImportError: cannot import name 'model_lib_v2' from 'object_detection' (C:\Python\379\lib\site-packages\object_detection\__init__.py)

And also in this below Image Image

It says to put the model_main_tf2.py in the training_demo folder but then model_main_tf2.py can't import the classes because they are all local classes take a look here

I am new to this so please help
If you want any other info Please Ask

Thanks!!

1 Answers

Your error looks like this, ImportError: cannot import name 'model_lib_v2' from 'object_detection' (C:\Python\379\lib\site-packages\object_detection\__init__.py).

Clearly, python is unable to find model_lib_v2.py at "C:\Python\379\lib\site-packages\object_detection" since that particular file is located in another directory (as shown in the image attached by you).

You need to check your working directory and set working directory to the path as shown in your attached image.

Related