I've been working on codes for Object Detection in Google Colab as in 1 and in 2 but, when using the following code sample:
!git clone --quiet https://github.com/tensorflow/models.git
!apt-get install -qq protobuf-compiler python-tk
!pip install -q Cython contextlib2 pillow lxml matplotlib PyDrive
!pip install -q pycocotools
!pip install tensorflow-object-detection-api
%cd ~/models/research
!protoc object_detection/protos/*.proto --python_out=.
import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'
!python object_detection/builders/model_builder_test.py
I'm obtaining this error:
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 20, in <module>
from object_detection.builders import model_builder
File "/usr/local/lib/python3.7/dist-packages/object_detection/builders/model_builder.py", line 22, in <module>
from object_detection.builders import box_predictor_builder
File "/usr/local/lib/python3.7/dist-packages/object_detection/builders/box_predictor_builder.py", line 20, in <module>
from object_detection.predictors import convolutional_box_predictor
File "/usr/local/lib/python3.7/dist-packages/object_detection/predictors/convolutional_box_predictor.py", line 22, in <module>
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
How can I use 'contrib' and other tensorflow v1 attributes with tensorflow v2? Appreciate any kind of help! Thank you in advance.