tensorrt
tensorrt copied to clipboard
tf-trt optimized model output shapes are empty/unknown.
model loading `def load_tf_saved_model(input_saved_model_dir): if not tf.compat.v1.saved_model.contains_saved_model(input_saved_model_dir): print("Please give valid saved model folder %s"%input_saved_model_dir)
print('TF Loading saved model {}...'.format(input_saved_model_dir))
if tf.__version__ == '1.15.0':
saved_model_loaded = tf.saved_model.load_v2(input_saved_model_dir, tags=[tag_constants.SERVING])
infer = saved_model_loaded.signatures[
signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY]
else:
saved_model_loaded = tf.saved_model.load(input_saved_model_dir, tags=[tag_constants.SERVING])
# saved_model_loaded = tf.compat.v1.saved_model.load()
infer = saved_model_loaded.signatures['serving_default']
return infer`
inference:
zz = infer(x)
print(zz)
{'detection_boxes': <tf.Tensor 'Stateful...e=float32>, 'detection_classes': <tf.Tensor 'Stateful...e=float32>, 'detection_multiclass_scores': <tf.Tensor 'Stateful...e=float32>, 'detection_scores': <tf.Tensor 'Stateful...e=float32>, 'num_detections': <tf.Tensor 'Stateful...e=float32>, 'raw_detection_boxes': <tf.Tensor 'Stateful...e=float32>, 'raw_detection_scores': <tf.Tensor 'Stateful...e=float32>}
special variables
function variables
'raw_detection_scores':<tf.Tensor 'StatefulPartitionedCall_2:6' shape=(?, ?, 2) dtype=float32>
'detection_multiclass_scores':<tf.Tensor 'StatefulPartitionedCall_2:2' shape=
How can I load model and get distinct detection values