Unable to get the ObjectDetector_SSD sample to work?

I have followed the README instructions to get the objectdetectorSSD to run but I’m failing on the UFF conversion step.

I’m testing with Jetpack 4.4 dp on a Xavier NX.

I have installed Tensorflow 2 as per these instructions: Jetson Zoo - eLinux.org.

When I run:

python3 /usr/lib/python3.6/dist-packages/uff/bin/convert_to_uff.py frozen_inference_graph.pb -O NMS -p /usr/src/tensorrt/samples/sampleUffSSD/config.py -o sample_ssd_relu6.uff

I get this error:

2020-06-07 11:48:33.930004: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
2020-06-07 11:48:36.009453: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer.so.7
2020-06-07 11:48:36.012461: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer_plugin.so.7
Loading frozen_inference_graph.pb
WARNING:tensorflow:From /usr/lib/python3.6/dist-packages/uff/bin/../../uff/converters/tensorflow/conversion_helpers.py:227: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Traceback (most recent call last):
  File "/usr/lib/python3.6/dist-packages/uff/bin/convert_to_uff.py", line 96, in <module>
    main()
  File "/usr/lib/python3.6/dist-packages/uff/bin/convert_to_uff.py", line 92, in main
    debug_mode=args.debug
  File "/usr/lib/python3.6/dist-packages/uff/bin/../../uff/converters/tensorflow/conversion_helpers.py", line 229, in from_tensorflow_frozen_model
    return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
  File "/usr/lib/python3.6/dist-packages/uff/bin/../../uff/converters/tensorflow/conversion_helpers.py", line 83, in from_tensorflow
    if tf.__version__ != tf_supported_ver:
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/util/module_wrapper.py", line 192, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow' has no attribute '__version__'

As a test I can execute:

$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf
2020-06-07 11:52:09.195625: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
2020-06-07 11:52:11.859123: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer.so.7
2020-06-07 11:52:11.862051: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer_plugin.so.7

>>> exit()

So tensorflow seems to be installed ok.

I have looked at the dockerfile used to builld the nvcr.io/nvidia/l4t-tensorflow:r32.4.2-tf1.15-py3 image and it seems to use tensorflow version 1.15. ??

Is version 1.15 an un-documented requirement and is that why the UFF converter is failing?

Hi,

This is a known issue in tensorflow-2.1.0+nv20.4-cp36-cp36m-linux_aarch64.whl.
A workaround is to comment out the version checker in uff parser dierctly.

/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py

...
#    if tf.__version__ != tf_supported_ver:
#        print("NOTE: UFF has been tested with TensorFlow " + str(tf_supported_ver) + ".")
#        print("WARNING: The version of TensorFlow installed on this system is not guaranteed to work with UFF.")
...

Thanks.

That did the job. Thank you. Would be good to get it added to the README or fixed in time for 5.0GA. ;-)

Hi,

This issue is fixed in our next TensorFlow package.
So you don’t need to do this once the new release is available.

Sorry for the inconvenience.
Thanks.