Problem after converting keras model into Tensorflow pb - 将keras模型转换为Tensorflow pb后的问题
I'm using keras 2.1.* with tensorflow 1.13.* backend. I save my model during training with .h5 format and after that I convert it into protobuf (.pb) model. Everything looks good during converting process, but the result of tensorflow model is a bit weird. It shows a little bit different results. Also I'm loading keras model with not compiled mode. Something like this.
import keras
keras.models.load_model('model.h5', compile=False)
Solution 1
Most probable the problem is related to running environment. There are some variables which are being computed in training phase for future use. If you don't change to test phase, it will use current values. For example dropout and batch normalization. If you use it in training mode, then for mean and variance it will use current values, but in test time it will use moving_mean and moving_variance. That's why you should call
import keras.backend as K
k.set_learning_phase(0) # 0 testing, 1 training mode
aipool discussion: https://ai-pool.com/d/problem_after_converting_keras_model_into_tensorflow_pb
Problem after converting keras model into Tensorflow pb - 将keras模型转换为Tensorflow pb后的问题的更多相关文章
- 【6】TensorFlow光速入门-python模型转换为tfjs模型并使用
本文地址:https://www.cnblogs.com/tujia/p/13862365.html 系列文章: [0]TensorFlow光速入门-序 [1]TensorFlow光速入门-tenso ...
- 将keras的h5模型转换为tensorflow的pb模型
h5_to_pb.py from keras.models import load_model import tensorflow as tf import os import os.path as ...
- 【4】TensorFlow光速入门-保存模型及加载模型并使用
本文地址:https://www.cnblogs.com/tujia/p/13862360.html 系列文章: [0]TensorFlow光速入门-序 [1]TensorFlow光速入门-tenso ...
- Deploying Keras model on Tensorflow Serving--
keras训练了个二分类的模型.需求是把keras模型跑到 tensorflow serving上 (TensorFlow Serving 系统用于在生产环境中运行模型) keras模型转 tenso ...
- [Tensorflow] 使用 model.save_weights() 保存 / 加载 Keras Subclassed Model
在 parameters.py 中,定义了各类参数. # training data directory TRAINING_DATA_DIR = './data/' # checkpoint dire ...
- tensorflow 2.0 技巧 | 自定义tf.keras.Model的坑
自定义tf.keras.Model需要注意的点 model.save() subclass Model 是不能直接save的,save成.h5,但是能够save_weights,或者save_form ...
- tensorflow模型ckpt转pb以及其遇到的问题
使用tensorflow训练模型,ckpt作为tensorflow训练生成的模型,可以在tensorflow内部使用.但是如果想要永久保存,最好将其导出成pb的形式. tensorflow已经准备好c ...
- tflearn 中文汉字识别,训练后模型存为pb给TensorFlow使用——模型层次太深,或者太复杂训练时候都不会收敛
tflearn 中文汉字识别,训练后模型存为pb给TensorFlow使用. 数据目录在data,data下放了汉字识别图片: data$ ls0 1 10 11 12 13 14 15 ...
- 将tflearn的模型保存为pb,给TensorFlow使用
参考:https://github.com/tflearn/tflearn/issues/964 解决方法: """ Tensorflow graph freezer C ...
随机推荐
- Linux学习方法和心态
如果单纯是为了架站,那我就可以毕业了. 成就感+兴趣=学习的动力. 不同的环境下,解决问题的办法有很多种,只要行得通,都是好方法. Distribution 安装 熟悉Shell环境 Shell脚本 ...
- day19
""" time 用于处理时间相关 1.获取时间 2.不同格式的时间转换 3.sleep函数"""import time# 浮点型的时间戳 ...
- 论文笔记:ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware
ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware 2019-03-19 16:13:18 Pape ...
- BUTXO详解
在比原链中,每个交易消耗之前交易生成的BUTXO 然后生成新的 BUTXO,账户的余额即所有属于该地址的未花费 BUTXO 集合,BTM 的全局状态即当前所有未花费的BUTXO 集合.我们用一个具体的 ...
- Go-延时函数defer
关于延时调用函数(Deferred Function Calls) 延时调用函数基本语法如下: defer func_name(param-list) {} 当一个函数前有关键字 defer ...
- Confluence-6.10.0+Jira-7.13+Crowd-3.2.1最全破解文档,附下载包
=========================================2019.4.19更改================================================ ...
- CSS之垂直水平居中方法
//居中方法1 position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; width: 346px; height ...
- js改变数组的两个元素的位子,互换、置顶
//js数组的元素上移和下移动 var fieldData=[ {name:'id',value:'ID'} , {name:'username',value:'用户名'} , {name:'emai ...
- element-UI——el-table添加序号
转载自:https://www.cnblogs.com/langxiyu/p/10641060.html Part.1 示例 当我们想在 el-table 中添加序号列时,如下: <el-tab ...
- 20175317 《Java程序设计》第六周学习总结
20175317 <Java程序设计>第六周学习总结 教材学习内容总结 第六周我学习了教材第七章与第十章的内容,了解了内部类.异常类与输入输出流的知识,学到了以下内容: 什么是内部类 如何 ...