tensorrt icon indicating copy to clipboard operation
tensorrt copied to clipboard

tf-trt optimized model output shapes are empty/unknown.

Open AhmadShaik opened this issue 5 years ago • 0 comments

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= dtype=float32> 'detection_classes':<tf.Tensor 'StatefulPartitionedCall_2:1' shape= dtype=float32> 'num_detections':<tf.Tensor 'StatefulPartitionedCall_2:4' shape= dtype=float32> 'detection_boxes':<tf.Tensor 'StatefulPartitionedCall_2:0' shape= dtype=float32> 'raw_detection_boxes':<tf.Tensor 'StatefulPartitionedCall_2:5' shape=(?, ?, 4) dtype=float32> 'detection_scores':<tf.Tensor 'StatefulPartitionedCall_2:3' shape= dtype=float32> len():7

How can I load model and get distinct detection values

AhmadShaik avatar Oct 29 '20 13:10 AhmadShaik