【VSCode部署模型】导出TensorFlow2.X训练好的模型信息

参考tensorflow2.0 C++加载python训练保存的pb模型

经过模型训练及保存,我们得到"OptimalModelDataSet2"文件夹,模型的保存方法(.h5.pb文件),参考【Visual Studio Code】c/c++部署tensorflow训练的模型

其中"OptimalModelDataSet2"文件夹保存着训练好的模型数据"saved_model.pb"

bash 复制代码
要在OptimalModelDataSet2所在的文件夹下执行:
$ saved_model_cli show --dir ./OptimalModelDataSet2
会得到:
The given SavedModel contains the following tag-sets:
'serve'
使用'serve',继续执行:
$ saved_model_cli show --dir ./OptimalModelDataSet2/ --tag_set serve
会得到:
The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:
SignatureDef key: "__saved_model_init_op"
SignatureDef key: "serving_default"
使用上述信息,继续:
$ saved_model_cli show --dir ./OptimalModelDataSet2/ --tag_set serve --signature_def serving_default
得到:
The given SavedModel SignatureDef contains the following input(s):
  inputs['input_1'] tensor_info:
      dtype: DT_FLOAT
      shape: (-1, 24)
      name: serving_default_input_1:0
The given SavedModel SignatureDef contains the following output(s):
  outputs['dense_30'] tensor_info:
      dtype: DT_FLOAT
      shape: (-1, 1)
      name: StatefulPartitionedCall:0
Method name is: tensorflow/serving/predict
这里输入和输出的name,要留好,c中调用会用到。
相关推荐
小鸡吃米…3 天前
基于 TensorFlow 的图像识别
人工智能·python·tensorflow
小鸡吃米…3 天前
TensorFlow - 构建计算图
人工智能·python·tensorflow
A懿轩A3 天前
【2026 最新】TensorFlow 安装配置详细指南 同时讲解安装CPU和GPU版本 小白也能轻松上手!逐步带图超详细展示(Windows 版)
人工智能·windows·python·深度学习·tensorflow
小鸡吃米…4 天前
TensorFlow 实现异或(XOR)运算
人工智能·python·tensorflow·neo4j
小鸡吃米…4 天前
TensorFlow 实现梯度下降优化
人工智能·python·tensorflow·neo4j
甄心爱学习4 天前
【LR逻辑回归】原理以及tensorflow实现
算法·tensorflow·逻辑回归
小鸡吃米…5 天前
TensorFlow 实现多层感知机学习
人工智能·python·tensorflow
小鸡吃米…5 天前
TensorFlow 优化器
人工智能·python·tensorflow
小鸡吃米…6 天前
TensorFlow 模型导出
python·tensorflow·neo4j
Jonathan Star8 天前
Ant Design (antd) Form 组件中必填项的星号(*)从标签左侧移到右侧
人工智能·python·tensorflow