查看Tensorflow SavedModel模型信息

当我们拿到别人提供的pb模型时,我们很可能不清楚inputs所需的参数,可以使用以下方法来查看模型信息:

  1. 找到你的tensorflow安装位置,依次定位到以下目录:
    tensorflow_core/python/tools
  2. 执行如下命令:
    python saved_model_cli.py show --dir 模型路径 --all

之后可以得到如下信息:

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['image_shape'] tensor_info:
        dtype: DT_FLOAT
        shape: (2)
        name: Placeholder_366:0
    inputs['input_image'] tensor_info:
        dtype: DT_FLOAT
        shape: (-1, -1, -1, 3)
        name: input_1:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['concat_11/concat:0'] tensor_info:
        dtype: DT_FLOAT
        shape: (-1, 4)
        name: concat_11/concat:0
    outputs['concat_12/concat:0'] tensor_info:
        dtype: DT_FLOAT
        shape: (-1)
        name: concat_12/concat:0
    outputs['concat_13/concat:0'] tensor_info:
        dtype: DT_INT32
        shape: (-1)
        name: concat_13/concat:0
  Method name is: tensorflow/serving/predict

由上面可知:

  1. 该pd有一个签名信息,且签名名称为serving_default
  2. 有两个inputs,因此需要传递两个参数,其中image_shape数据为一个一维数组,里面有两个元素;input_image为一个四维数组
  3. 有三个输出,concat_11/concat:0为一个1*4的矩阵,concat_12/concat:0为一个float型数据,concat_13/concat:0为一个int型数据。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

得食猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值