NVIDIA-AI-IOT / tf_trt_models

TensorFlow models accelerated with NVIDIA TensorRT
BSD 3-Clause "New" or "Revised" License
684 stars 244 forks source link

KeyError: "The name 'detection_scores:0' refers to a Tensor which does not exist. The operation, 'detection_scores', does not exist in the graph." #28

Open isra60 opened 5 years ago

isra60 commented 5 years ago

In this part of code of Jupyter notebook i have this error

I have tried with ssd_mobilenet_v1_coco

tf_config = tf.ConfigProto()
tf_config.gpu_options.allow_growth = True

tf_sess = tf.Session(config=tf_config)

tf.import_graph_def(trt_graph, name='')

tf_input = tf_sess.graph.get_tensor_by_name(input_names[0] + ':0')
tf_scores = tf_sess.graph.get_tensor_by_name('detection_scores:0')
tf_boxes = tf_sess.graph.get_tensor_by_name('detection_boxes:0')
tf_classes = tf_sess.graph.get_tensor_by_name('detection_classes:0')

Error

`--------------------------------------------------------------------------- KeyError Traceback (most recent call last)

in 7 8 tf_input = tf_sess.graph.get_tensor_by_name(input_names[0] + ':0') ----> 9 tf_scores = tf_sess.graph.get_tensor_by_name('detection_scores:0') 10 tf_boxes = tf_sess.graph.get_tensor_by_name('detection_boxes:0') 11 tf_classes = tf_sess.graph.get_tensor_by_name('detection_classes:0') /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py in get_tensor_by_name(self, name) 3662 raise TypeError("Tensor names are strings (or similar), not %s." % 3663 type(name).__name__) -> 3664 return self.as_graph_element(name, allow_tensor=True, allow_operation=False) 3665 3666 def _get_tensor_by_tf_output(self, tf_output): /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py in as_graph_element(self, obj, allow_tensor, allow_operation) 3486 3487 with self._lock: -> 3488 return self._as_graph_element_locked(obj, allow_tensor, allow_operation) 3489 3490 def _as_graph_element_locked(self, obj, allow_tensor, allow_operation): /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation) 3528 raise KeyError("The name %s refers to a Tensor which does not " 3529 "exist. The operation, %s, does not exist in the " -> 3530 "graph." % (repr(name), repr(op_name))) 3531 try: 3532 return op.outputs[out_n] KeyError: "The name 'detection_scores:0' refers to a Tensor which does not exist. The operation, 'detection_scores', does not exist in the graph."`
ghost commented 5 years ago

Sorry about this. We just merged a branch into master that corrects this issue. Could you please pull the changes, and re-run the installation script?

Thanks, John

isra60 commented 5 years ago

Hi Thank you.

Now is working. Do you know if more models are going to be integrated?

And also the NMS change in the PR is for change the nms parameter that you recommend to modify??