import tensorflow as tf
from object_detection.utils import config_util_tfod
from object_detection.protos import pipeline_pb2
from google.protobuf import text_format
But I get the following error:
ImportError Traceback (most recent call last)
Cell In[61], line 2
1 import tensorflow as tf
----> 2 from object_detection.utils import config_util_tfod
3 from object_detection.protos import pipeline_pb2
4 from google.protobuf import text_format
ImportError: cannot import name ‘config_util_tfod’ from ‘object_detection.utils’ (C:\Users\Rysa\Coding\TFODCourse\tfod\lib\site-packages\object_detection-0.1-py3.8.egg\object_detection\utils_init_.py)
ImportError: cannot import name ‘config_util_tfod’ from ‘object_detection.utils’
Here the module name has changed or if the version of the object detection library you are using does not have that specific module.
It seems you are not using an officially supported object detection model. I recommend using the ‘tf-models-official’ library and following the tutorial at Object detection with Model Garden | TensorFlow Core.
But I get lost whenever I’m installing it. Here’s another error I’m frequently encountering:
Traceback (most recent call last):
File “Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py”, line 21, in
import tensorflow.compat.v1 as tf
ModuleNotFoundError: No module named ‘tensorflow.compat’
I would really appreciate it if you could help. I’m still new to Tensorflow and would like to enhance my understanding of it. Thank you!
We are not supporting research models at this point of time.
As mentioned above, we have come up with a new collection of official models with improved speed and performance. For more details please refer to TensorFlow Official Models.
If you are still looking for instructions on how to setup research models
import os
import pathlib
# Clone the tensorflow models repository if it doesn't already exist
if "models" in pathlib.Path.cwd().parts:
while "models" in pathlib.Path.cwd().parts:
os.chdir('..')
elif not pathlib.Path('models').exists():
!git clone --depth 1 https://github.com/tensorflow/models
# Install the Object Detection API
%%bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .