TensorRT 6 : import uff error

After I installed tensorrt, I tested whether I install tensorrt successfully. I run ‘import tensorrt’ successfully, but error occurred when running ‘import uff’,the error is as fllows:
Traceback (most recent call last):
File “/home/graphic/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 18, in
from tensorflow import GraphDef
ImportError: cannot import name ‘GraphDef’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/home/graphic/anaconda3/lib/python3.6/site-packages/uff/init.py”, line 2, in
from uff.converters.tensorflow.conversion_helpers import from_tensorflow # noqa
File “/home/graphic/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 23, in
https://www.tensorflow.org/install/""".format(err))
ImportError: ERROR: Failed to import module (cannot import name ‘GraphDef’)

I am sure I have installed tensorflow.I don’t know how to solve this error,can anybody help me?

Hi,
It seems to be due to Tensorflow version.
UFF converter not supporting TF version 2.0.
Please check the tensorflow version and install tensorflow version 1.15 or 1.14.

Thanks

So, how to convert UFF files in 2.0 environment

Hi,

Another alternative is to convert your model to ONNX instead using tf2onnx and then convert to TensorRT using ONNX parser. Any layer that are not supported needs to be replaced by custom plugin.
https://github.com/onnx/tensorflow-onnx
https://github.com/onnx/onnx-tensorrt/blob/master/operators.md

Thanks