0

I followed instructions (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) to install the Tensorflow Object Detection API. I use Anaconda on ubuntu18.4 and all of the steps in the instructions seemed to complete OK.

When I train to train my model with the following command:

python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config

I get the following error:

Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
  File "model_main_tf2.py", line 34, in <module>
    from object_detection import model_lib_v2
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/model_lib_v2.py", line 28, in <module>
    from object_detection import eval_util
  File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/eval_util.py", line 30, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

I get the error mentioned in the headline. I would be very thankful if someone could help me with a code example to solve the problem.

1 Answers1

0

It looks like you are using the tensorflow 2.0 version, but the code you use needs tf 1.14. The module contrib is not available in tf 2.0 anymore, thats why you are seeing this error. So you should set up a new environment and install tf 1.14 there, so you can run the code properly without ruining your tf 2.0 environment

MichaelJanz
  • 1,775
  • 2
  • 8
  • 23