Tensorflow object detection error for tenserflow.compact module not found

I wrote this code which is below

VERIFICATION_SCRIPT = os.path.join(paths[‘APIMODEL_PATH’], ‘research’, ‘object_detection’, ‘builders’, ‘model_builder_tf2_test.py’)

Verify Installation



import tensorflow as tf
from object_detection.utils import config_util
from object_detection.protos import pipeline_pb2
from google.protobuf import text_format

and i am getting an error in both of the code :-

Traceback (most recent call last):
File “D:\OBJECT DETECTION\TFODCourse\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’

Hi @gaurav_sharma, I can see that you are using a research model for your object detection training, those models contain some deprecated lines of code. Tensorflow does not officially support research models.

I recommend you to use the official tensorflow/models for your use case. Please refer to this tutorial for implementing object detection using official models and let us know if you faceing any errors? Thank you.

1 Like

While the above response is accurate, you can get rid of the error message by updating the python path … something in this line