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

I am setting setting up TensorFlow Object Detection API for retraining of a pre-trained model on Jetson Orin Development Kit.
Following are some of the details:

  • OS: Linux ubuntu 5.10.104-tegra #1 SMP PREEMPT Tue Jan 24 15:09:44 PST 2023 aarch64 aarch64 aarch64 GNU/Linux
  • JetPack 5.1
  • Python 3.8.10
  • tensorflow version: 2.11.0
  • tesorflow gpu support is True and can be verified by the following output:
f.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2023-03-24 12:29:52.194575: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.239510: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.239714: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.865652: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.865972: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.866044: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Could not identify NUMA node of platform GPU id 0, defaulting to 0.  Your kernel may not have been built with NUMA support.
2023-03-24 12:29:52.866163: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-24 12:29:52.866298: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /device:GPU:0 with 19313 MB memory:  -> device: 0, name: Orin, pci bus id: 0000:00:00.0, compute capability: 8.7
True

When I try to test that the Object Detection API installed using the link [Installation — TensorFlow 2 Object Detection API tutorial documentation](https://Object Detection API Installation).
Running the python object_detection/builders/model_builder_tf2_test.py results into following error:

/home/ki/.local/lib/python3.8/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.15) or chardet (5.1.0)/charset_normalizer (2.0.12) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
Traceback (most recent call last):
  File "builders/model_builder_tf2_test.py", line 24, in <module>
    from object_detection.builders import model_builder
  File "/home/ki/.local/lib/python3.8/site-packages/object_detection/builders/model_builder.py", line 22, in <module>
    from object_detection.builders import box_predictor_builder
  File "/home/ki/.local/lib/python3.8/site-packages/object_detection/builders/box_predictor_builder.py", line 20, in <module>
    from object_detection.predictors import convolutional_box_predictor
  File "/home/ki/.local/lib/python3.8/site-packages/object_detection/predictors/convolutional_box_predictor.py", line 22, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

Is there someone else encountering the same problem or can suggest any solution?

Thanks in advance,
Saqib

TensorFlow itself is installed using this official guide from nvidia

Hi,

It looks like this error is related to TensorFlow and Object Detection API compatibility.
We can find several similar topics in the repository.

Could you open a topic to the TensorFlow team to get better help?

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.