Skip to content

This doesn't work with Tensorflow 2.xx #109

@Russ76

Description

@Russ76

Comments share that this only works with Tensorflow 1.xx
How can we update the code to work with newer versions? I'm using Ubuntu 20.04 and Tensorflow 2.9.1

(tf) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:~/TensorFlow/Python-examples$ python3 object_detection_camera.py
Traceback (most recent call last):
File "/home/russ/TensorFlow/Python-examples/object_detection_camera.py", line 92, in
from object_detection.builders import model_builder
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/builders/model_builder.py", line 22, in
from object_detection.builders import box_predictor_builder
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/builders/box_predictor_builder.py", line 20, in
from object_detection.predictors import convolutional_box_predictor
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/predictors/convolutional_box_predictor.py", line 22, in
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

Also with this Python example:

(tf) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:/TensorFlow/Python-examples$ python3 plot_object_detection_checkpoint.py
Downloading data from https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/test_images/image1.jpg
129862/129862 [==============================] - 0s 2us/step
Downloading data from https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/test_images/image2.jpg
1415684/1415684 [==============================] - 0s 0us/step
Downloading data from http://download.tensorflow.org/models/object_detection/tf2/20200711/centernet_hg104_1024x1024_coco17_tpu-32.tar.gz
1426460092/1426460092 [==============================] - 52s 0us/step
Downloading data from https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/data/mscoco_label_map.pbtxt
5056/5056 [==============================] - 0s 0us/step
Traceback (most recent call last):
File "/home/russ/TensorFlow/Python-examples/plot_object_detection_checkpoint.py", line 105, in
from object_detection.builders import model_builder
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/builders/model_builder.py", line 22, in
from object_detection.builders import box_predictor_builder
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/builders/box_predictor_builder.py", line 20, in
from object_detection.predictors import convolutional_box_predictor
File "/home/russ/miniconda3/envs/tf/lib/python3.9/site-packages/object_detection/predictors/convolutional_box_predictor.py", line 22, in
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
(tf) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:
/TensorFlow/Python-exam

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleNo recent activity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions