Consider saving to the Tensorflow SavedModel format (by setting save_format=“tf“) or using `save_wei
完整报错如下:
Traceback (most recent call last):File "/ad_ctr/new_thought/tmp4.py", line 459, in <module>model.save(save_path.format('FCINN', 'FCINN-11-13.h5'))File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/network.py", line 1052, in savesignatures, options)File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/saving/save.py", line 128, in save_model'Saving the model to HDF5 format requires the model to be a '
NotImplementedError: Saving the model to HDF5 format requires the model to be a Functional model or a Sequential model. It does not work for subclassed models, because such models are defined via the body of a Python method, which isn't safely serializable. Consider saving to the Tensorflow SavedModel format (by setting save_format="tf") or using `save_weights`.
原因:自定义Keras的类是不能保存成.h5
格式的,可以保存权重或者save_format="tf"
from tensorflow.keras.models import save_model, load_model# model.save(save_path.format('FCINN', 'test_FCINN-11-13.h5'))
model.save(save_path.format('FCINN', 'test_FCINN-11-13_serving'), save_format="tf")
# model = load_model(save_path.format('FCINN', 'test_FCINN-11-13.h5'))
model = load_model(save_path.format('FCINN', 'test_FCINN-11-13_serving'))
参考:
https://my.oschina.net/u/4396881/blog/3375667
https://www.cnblogs.com/Manuel/p/13357212.html
tf.saved_model.save
方式:
https://cloud.tencent.com/developer/article/1785139
Consider saving to the Tensorflow SavedModel format (by setting save_format=“tf“) or using `save_wei相关推荐
- TensorFlow2.0 Guide官方教程 学习笔记17 -‘Using the SavedModel format‘
本笔记参照TensorFlow官方教程,主要是对'Save a model-Training checkpoints'教程内容翻译和内容结构编排,原文链接:Using the SavedModel f ...
- Tensorflow高级API的进阶--利用tf.contrib.learn建立输入函数
正文共5958个字,预计阅读时间15分钟. 笔记整理者:王小草 笔记整理时间:2017年2月27日 笔记对应的官方文档:https://www.tensorflow.org/get_started/i ...
- TF:tensorflow框架中常用函数介绍—tf.Variable()和tf.get_variable()用法及其区别
TF:tensorflow框架中常用函数介绍-tf.Variable()和tf.get_variable()用法及其区别 目录 tensorflow框架 tensorflow.Variable()函数 ...
- TensorFlow基础篇(六)——tf.nn.max_pool()和tf.nn.avg_pool()
tf.nn.max_pool()和tf.nn.avg_pool()是TensorFlow中实现最大池化和平均池化的函数,在卷积神经网络中比较核心的方法. 有些和卷积很相似,可以参考TensorFlow ...
- TensorFlow实践(15)——使用tf.device方法指定节点执行设备
TensorFlow实践(15)--使用tf.device方法指定节点执行设备 (一)前 言 (二)tf.device方法指定节点执行设备 (三)总 结 (一)前 言 当我们调用sess.run()方 ...
- 【Tensorflow教程笔记】常用模块 tf.function :图执行模式
基础 TensorFlow 基础 TensorFlow 模型建立与训练 基础示例:多层感知机(MLP) 卷积神经网络(CNN) 循环神经网络(RNN) 深度强化学习(DRL) Keras Pipeli ...
- TensorFlow学习笔记(十七)tf.nn.conv2d
在给定的4D input与filter下计算2D卷积输入shape为[batch, height, width, in_channels] TensorFlow的CNN代码中有 tf.nn.conv2 ...
- 【Tensorflow教程笔记】常用模块 tf.train.Checkpoint :变量的保存与恢复
基础 TensorFlow 基础 TensorFlow 模型建立与训练 基础示例:多层感知机(MLP) 卷积神经网络(CNN) 循环神经网络(RNN) 深度强化学习(DRL) Keras Pipeli ...
- tensorflow 的 Batch Normalization 实现(tf.nn.moments、tf.nn.batch_normalization)
tensorflow 在实现 Batch Normalization(各个网络层输出的归一化)时,主要用到以下两个 api: tf.nn.moments(x, axes, name=None, kee ...
- tensorflow学习之常用函数总结:tensorflow官方例子中的诸如tf.reduce_mean()这类函数
前言 tensorflow官网给的例子用到了很多函数,然后并没有具体说明,还要自己去翻文档,有些函数是很常用的,下面来一一总结. 正文 一,tensorflow中有一类在tensor的某一维度上求值的 ...
最新文章
- Nginx其他配置——日志管理、网页压缩、访问控制
- 笔记-计算机网络基础-开放系统互连参考模型OSI
- 金融科技监管何时才能完善?
- Cookie中文存储页面500问题
- 交互设计精髓_设计空间的精髓
- P5404-[CTS2019]重复【KMP,dp】
- linux普通用户命令权限,Linux普通用户没有权限使用命令怎么办
- 多线程爬虫工作流程图 to 子年
- Python 回归 普通最小二乘法(Ordinary Least Squares)
- it项目管理案例_盈通顾问项目管理精英训练营(第一期)
- JavaScript中的match方法和search方法
- Java 开发环境搭建
- 当R遇上Docker的第一步
- (13)Spring框架----Spring与Mybatis的框架整合(XML配置详解)
- ffmpeg实战教程(十二)为视频添加/更换背景音乐
- CSS学习笔记 | CSS复合选择器
- unity新动画系统之动画层和动画遮罩
- 搭建一整套电销机器人系统需要哪些技术和资源
- 【Python标准库】base64模块
- python基于django的考研报名交流平台