tensorflow / models

Models and examples built with TensorFlow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'tensorflow' has no attribute 'contrib'

Rajcr2 opened this issue · comments

Hello, I am using TFOD API for custom object detection.
While during last step of installation verification. After, Running following command -
!python object_detection/builders/model_builder_tf2_test.py

I faced following error. How to resolve this issue ?


2024-05-26 11:06:06.451631: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-05-26 11:06:06.451702: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-05-26 11:06:06.454451: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-05-26 11:06:07.882734: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "/content/drive/MyDrive/Tf_Raj/models/research/object_detection/builders/model_builder_tf2_test.py", line 24, in
from object_detection.builders import model_builder
File "/usr/local/lib/python3.10/dist-packages/object_detection/builders/model_builder.py", line 22, in
from object_detection.builders import box_predictor_builder
File "/usr/local/lib/python3.10/dist-packages/object_detection/builders/box_predictor_builder.py", line 20, in
from object_detection.predictors import convolutional_box_predictor
File "/usr/local/lib/python3.10/dist-packages/object_detection/predictors/convolutional_box_predictor.py", line 22, in
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
`

I am currently using Google Colab.
Tensorflow version = 2.15.0 and I followed this documentation - https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html
Pls help Thank You.

Try:
pip install tf_slim
and change the import to:
import tf_slim as slim

tf.contrib is depreciated.