Cannot import name 'config_util_tfod' from 'object_detection.utils'

I’m running the code:

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\

How would I be able to solve it?


Welcome to the Tensorflow Forum!

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.

Thank you!

1 Like

Thanks for the warm welcome!

I’m actually using the official object detection model following nicknochnack’s tutorial.

nicknochnack/TFODCourse (
Here’s the code it uses to install the object detection model:

if not os.path.exists(os.path.join(paths['APIMODEL_PATH'], 'research', 'object_detection')):
    !git clone {paths['APIMODEL_PATH']}
# Install Tensorflow Object Detection 
    !apt-get install protobuf-compiler
    !cd Tensorflow/models/research && protoc object_detection/protos/*.proto --python_out=. && cp object_detection/packages/tf2/ . && python -m pip install . 
    !move {paths['PROTOC_PATH']}
    !cd {paths['PROTOC_PATH']} && tar -xf
    os.environ['PATH'] += os.pathsep + os.path.abspath(os.path.join(paths['PROTOC_PATH'], 'bin'))   
    !cd Tensorflow/models/research && protoc object_detection/protos/*.proto --python_out=. && copy object_detection\\packages\\tf2\\ && python build && python install
    !cd Tensorflow/models/research/slim && pip install -e .

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\”, 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:
elif not pathlib.Path('models').exists():
  !git clone --depth 1

# Install the Object Detection API
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/ .
python -m pip install .

Thank you!

where you able to find the solution for this ? i am exactly facing the same issue, please help me out