NVIDIA / NVIDIA/TensorRT

tensorflow_object_detection_api example breaks due to dependecies

Open
#3,120 4 comments 0 reactions 1 assignee View on GitHub

@zerollzeng is already working on this.

Since Jul 12, 2023.

triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Description

Running the tensorflow object detection example as mentioned in the guide (https://github.com/NVIDIA/TensorRT/blob/release/8.6/samples/python/tensorflow_object_detection_api/README.md) does not work. This includes starting from the mentioned docker image, and performing each step exactly as stated in the guide.

My current workaround is to fix the tensorflow-models and numpy versions in the setup.py from "models/research"

Environment

TensorRT Version: 8.0.3.4

NVIDIA GPU: NVIDIA GeForce GTX 1080 Ti

NVIDIA Driver Version: 510.68.02

CUDA Version: 11.6

CUDNN Version: 8.2.4

Operating System: Ubuntu 20.04.3 LTS

Python Version (if applicable): 3.8.10

Tensorflow Version (if applicable): container comes with 2.6.0nv but setup guide overwrites it to 2.13

PyTorch Version (if applicable):

Baremetal or Container (if so, version): nvcr.io/nvidia/tensorflow:21.10-tf2-py3

Steps To Reproduce

Running the exact setup stated in https://github.com/NVIDIA/TensorRT/blob/release/8.6/samples/python/tensorflow_object_detection_api/README.md is enough. The code breaks when running "exporter_main_v2.py":

root@8b3443e5f2ab:/workspace/models/research/object_detection# python exporter_main_v2.py \
>     --input_type float_image_tensor \
object_detecti>     --trained_checkpoint_dir ~/TensorRT/samples/python/tensorflow_object_detection_api/ssd_mobilenet_v2_320x320_coco17_tpu-8/checkpoint/ \
>     --pipeline_config_path ~/TensorRT/samples/python/tensorflow_object_detection_api/ssd_mobilenet_v2_320x320_coco17_tpu-8/pipeline.config  \
>     --output_directory  ~/TensorRT/samples/python/tensorflow_object_detection_api/tfod_out
2023-07-10 00:16:55.220116: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
  File "exporter_main_v2.py", line 103, in <module>
    import tensorflow.compat.v2 as tf
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/__init__.py", line 38, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/__init__.py", line 45, in <module>
    from tensorflow.python.feature_column import feature_column_lib as feature_column
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/feature_column/feature_column_lib.py", line 18, in <module>
    from tensorflow.python.feature_column.feature_column import *
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/feature_column/feature_column.py", line 143, in <module>
    from tensorflow.python.layers import base
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/layers/base.py", line 16, in <module>
    from tensorflow.python.keras.legacy_tf_layers import base
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/__init__.py", line 25, in <module>
    from tensorflow.python.keras import models
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/models.py", line 25, in <module>
    from tensorflow.python.keras.engine import training_v1
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/engine/training_v1.py", line 46, in <module>
    from tensorflow.python.keras.engine import training_arrays_v1
  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/engine/training_arrays_v1.py", line 37, in <module>
    from scipy.sparse import issparse  # pylint: disable=g-import-not-at-top
  File "/usr/local/lib/python3.8/dist-packages/scipy/sparse/__init__.py", line 229, in <module>
    from .base import *
  File "/usr/local/lib/python3.8/dist-packages/scipy/sparse/base.py", line 8, in <module>
    from .sputils import (isdense, isscalarlike, isintlike,
  File "/usr/local/lib/python3.8/dist-packages/scipy/sparse/sputils.py", line 17, in <module>
    supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
  File "/usr/local/lib/python3.8/dist-packages/scipy/sparse/sputils.py", line 17, in <listcomp>
    supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
  File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 320, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'typeDict'

Also, when running the installation "pip --use-deprecated=legacy-resolver install ." there are multiple conflicts:

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
tensorflow 2.13.0 requires absl-py>=1.0.0, but you'll have absl-py 0.12.0 which is incompatible.
tensorflow 2.13.0 requires numpy<=1.24.3,>=1.22, but you'll have numpy 1.19.4 which is incompatible.
tensorflow-metadata 1.2.0 requires protobuf<4,>=3.13, but you'll have protobuf 4.23.4 which is incompatible.
tensorboard 2.13.0 requires grpcio>=1.48.2, but you'll have grpcio 1.39.0 which is incompatible.
google-auth-oauthlib 1.0.0 requires google-auth>=2.15.0, but you'll have google-auth 1.35.0 which is incompatible.
matplotlib 3.7.2 requires numpy>=1.20, but you'll have numpy 1.19.4 which is incompatible.
pandas 2.0.3 requires numpy>=1.20.3; python_version < "3.10", but you'll have numpy 1.19.4 which is incompatible.
google-api-core 2.11.1 requires google-auth<3.0.dev0,>=2.14.1, but you'll have google-auth 1.35.0 which is incompatible.
scikit-learn 1.3.0 requires scipy>=1.5.0, but you'll have scipy 1.4.1 which is incompatible.
tensorflow-model-optimization 0.7.5 requires absl-py~=1.2, but you'll have absl-py 0.12.0 which is incompatible.
tensorflow-model-optimization 0.7.5 requires numpy~=1.23, but you'll have numpy 1.19.4 which is incompatible.
tf-models-official 2.13.0 requires numpy>=1.20, but you'll have numpy 1.19.4 which is incompatible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.