【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中调用会用到。
相关推荐
mftang4 天前
TensorFlow Lite Micro:面向TinyML系统的嵌入式机器学习推理框架
人工智能·机器学习·tensorflow
中微极客13 天前
TensorFlow模型量化实战:从精度到延迟的优化指南
人工智能·python·tensorflow
敲代码的猴先生14 天前
论文分享 | TensorAbuse:通过滥用TensorFlow API将AI模型转化为恶意软件
人工智能·python·语言模型·tensorflow·论文笔记
想你依然心痛17 天前
TensorFlow Lite Micro:在MCU上运行神经网络推理——量化、算子支持与内存优化
单片机·神经网络·tensorflow
红石程序员18 天前
python3.11配置tensorflow-gpu版本环境
人工智能·tensorflow·python3.11
冷小鱼1 个月前
TensorFlow 2.21 进阶实战:从训练优化到生产部署的完整指南
人工智能·pytorch·python·tensorflow
木叶子---1 个月前
前端打包出错
前端·人工智能·tensorflow
现代野蛮人1 个月前
【深度学习】 —— 几种优化器对比实验
人工智能·深度学习·分类·tensorflow
希冀1232 个月前
【CSS学习第八篇】
css·学习·tensorflow
ZC跨境爬虫2 个月前
跟着 MDN 学CSS day_51:支持旧浏览器的布局策略
前端·css·html·tensorflow·媒体