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
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?

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.


So, how to convert UFF files in 2.0 environment


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.