2

I'm attempting to train a model on TensorFlow, and I've used Nick's video as reference:

https://youtu.be/yqkISICHH-U?si=IYW6Jsqhs0gCwMyc&t=8267

I've experienced following error:

Traceback (most recent call last):
  
File "D:\Passion Project\TensorFlow OD\Tensorflow\models\research\Tensorflow\models\research\object_detection\model_main_tf2.py", 
line 31, in <module> from object_detection import model_lib_v2

ImportError: cannot import name 'model_lib_v2' from 'object_detection' 
(C:\Users\stanf\AppData\Local\Programs\Python\Python310\lib\site-packages\object_detection\__init__.py)

enter image description here

I've tried clean install my TensorFlow; tried adding FilePath by

My Computer > Properties > Advanced System Settings > Environment Variables

but both didn't work. I also looked up past posts but none worked out

Any help is appreciated

8
  • I don't know how exactly you installed it, but if you used something like 'pip install object-detection', you need to install it from tensorflow's own repo instead. (The path you shared seems to be calling from within Python) Commented Oct 29 at 8:24
  • Are you talking about this repo? github.com/tensorflow/models/blob/master/research/… Commented Oct 29 at 9:05
  • 1
    Please include your complete error message. Commented Oct 29 at 9:06
  • What package is throwing this error? is it pypi.org/project/object-detection/#data ? Commented Oct 29 at 9:07
  • 1
    @RicradoWu, The ImportError is caused by a conflict where Python is loading a generic object-detection package from your site-packages instead of the local version in your project folder. To fix it, please follow these steps: 1) Run pip uninstall object-detection to remove the conflicting package. 2) cd into your project's models\research directory. 3) Run protoc object_detection/protos/*.proto --python_out=. to compile protobufs. 4) Run python -m pip install . to install the correct local version. Commented Oct 30 at 5:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.