Im trying to train a model using TensorFlow.
When running
python Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=Tensorflow/workspace/models/my_ssd_mobnet --pipeline_config_path=Tensorflow/workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=5000
I get this
ImportError: cannot import name 'model_lib_v2' from 'object_detection' (C:\Users\lais\AppData\Local\Programs\Python\Python39\lib\site-packages\object_detection\__init__.py)
This is my directory structure
RealTimeDetection
Tensorflow
workspace
models
research
object_detection
model_main_tf2.py
model_lib_v2.py
The models folder is from https://github.com/tensorflow/models so I know its supposed to work
What I think why its not working is that, the model_main_tf2.py is trying to import from
C:\Users\lais\AppData\Local\Programs\Python\Python39\lib\site-packages\object_detection\
and not from
C:\Users\lais\Desktop\SP\CIOT\projects\RealTimeObjectDetection\Tensorflow\models\research\object_detection
How do I make the code look for the libraries in the models\research\object_detection instead? Or is my theory wrong?
CodePudding user response:
you can try using a relative import by starting the import with a "."