google / automl

Google Brain AutoML
Apache License 2.0
6.24k stars 1.45k forks source link

input and output tensors names #945

Closed MSch8791 closed 3 years ago

MSch8791 commented 3 years ago

Hi,

I would like to convert saved model to TensorRT UFF file. And for this mean I need to know the inputs tensors and output tensors names ? I've tried to read it from graph under tensorboard, but it is quite unreadable.

Thanks a lot !

glenvorel commented 3 years ago

You can use the saved_model_cli utility.

$ saved_model_cli show --dir path/to/saved_model_directory/ --all

Keras model

MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['__saved_model_init_op']:
  The given SavedModel SignatureDef contains the following input(s):
  The given SavedModel SignatureDef contains the following output(s):
    outputs['__saved_model_init_op'] tensor_info:
        dtype: DT_INVALID
        shape: unknown_rank
        name: NoOp
  Method name is: 

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['images'] tensor_info:
        dtype: DT_UINT8
        shape: (1, -1, -1, 3)
        name: serving_default_images:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['output_0'] tensor_info:
        dtype: DT_FLOAT
        shape: (1, 100, 4)
        name: StatefulPartitionedCall:0
    outputs['output_1'] tensor_info:
        dtype: DT_FLOAT
        shape: (1, 100)
        name: StatefulPartitionedCall:1
    outputs['output_2'] tensor_info:
        dtype: DT_FLOAT
        shape: (1, 100)
        name: StatefulPartitionedCall:2
    outputs['output_3'] tensor_info:
        dtype: DT_INT32
        shape: (1)
        name: StatefulPartitionedCall:3
  Method name is: tensorflow/serving/predict

Input tensor is images. Output tensors are:

Legacy model

MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['image_arrays:0'] tensor_info:
        dtype: DT_UINT8
        shape: (-1, -1, -1, -1)
        name: image_arrays:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['detections:0'] tensor_info:
        dtype: DT_FLOAT
        shape: (1, 100, 7)
        name: detections:0
  Method name is: tensorflow/serving/predict

Input tensor is image_arrays:0. Output tensor is detections:0.