Convert Tensorflow Deeplab Segmentation Model to TensorRT Engine Fail



I am trying to convert Tensorflow Deeplab Segmentation Model to TensorRT engine.

I use AWS EC2 Ubuntu 18.04 instance. I have installed TensorRT via Nvidia container.

I have trained Deeplab frozengraph model and for conversion I use this script from TensorRT documentation. (Accelerating Inference In TF-TRT User Guide :: NVIDIA Deep Learning Frameworks Documentation)

This is my script:

import tensorflow as tf

from tensorflow.python.compiler.tensorrt import trt_convert as trt

with tf.Session() as sess:

# First deserialize your frozen graph:

with tf.gfile.GFile('frozen_inference_graph.pb', 'rb') as f:

    frozen_graph = tf.GraphDef()


# Now you can create a TensorRT inference graph from your

# frozen graph:

converter = trt.TrtGraphConverter(


    nodes_blacklist=['SemanticPredictions:0']) #output nodes

trt_graph = converter.convert()

# Import the TensorRT graph into a new graph and run:

output_node = tf.import_graph_def(



When I run this script, I got following error.

Error is: tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor ‘import/ImageTensor’ with dtype uint8 and shape [1,?,?,3]
[[{{node import/ImageTensor}}]]

How can I fix this issue?
My input tensor size is 1300,1000,3. But I couldnt figure out that how can I add this information to the conversion script?

Any help, suggestion?

This is kind of urgent for me.



TensorRT Version: TensorRT 7.2.1
GPU Type: Tesla K80
Nvidia Driver Version: 450.142.00
CUDA Version: 11.1.0
CUDNN Version:
Operating System + Version: Ubuntu 18.04 Deep Learning AMI
Python Version (if applicable): 3.6.9
TensorFlow Version (if applicable): 1.15.4
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered


Could you please share us issue repro model and script to try from our end for better assistance.

Thank you.