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 ...
随机推荐
- 对于SQL注入的理解
从网上搜索的资料,结合自己的理解整理了一下,网友们在查看时若有发现问题,还请不吝指正,谢谢! 1.什么是SQL注入? ——官方说法:把SQL命令插入到web表单验证的输入框中,提交到服务器,以达到越过 ...
- style1
<!doctype html> 我的简历 基本信息 姓名 张三 性别 男 应聘职位 WEb前端工程师 联系方式 手机 12312341234 Email joinefe@baidu.com ...
- ubuntu学习笔记
Linux操作系统 locale –a查看支持语言 ls查看目录 ls .l / 查看根目录 apt-get –h 安装软件看帮助信息 sudo apt-get inatall packge 安装包 ...
- WinForm 设置窗体启动位置在活动屏幕右下角
WinForm 设置窗体启动位置在活动屏幕右下角 在多屏幕环境下, 默认使用鼠标所在的屏幕 1. 设置窗体的 StartPosition 为 FormStartPosition.Manual. 2. ...
- linux下的nmap工具能干什么?
答:可以用来探测远程主机的操作系统类型,使用方法如下: nmap -A <ip address>
- Linux下SSH远程连接断开后让程序继续运行解决办法
一.screen安装 yum install screen #CentOS安装 sudo apt-get install screen #ubuntu安装 二.screen常用命令 screen ...
- RFS--RequestLibrary
一.requestlibrary关键字1.1create session:创建一个session回话.Create Session: 创建一个session,连接某个服务器.Create Ntlm S ...
- php LBS(附近地理位置)功能实现的一些思路
在开发中经常会遇到把数据库已有经纬度的地方进行距离排序然后返回给用户 例如一些外卖app打开会返回附近的商店,这个是怎么做到的呢? 思路一: 根据用户当前的位置,用计算经纬度距离的算法逐一计算比对距离 ...
- 区块链 编译android geth 填坑记录 ubuntu
下载geth 源码 直接 make android 下载android ndk sdk 配置环境变量cd 安装golang 设置环境变量 发现没有gomobile命令 按照wiki方法 执行安装g ...
- Pycharm快捷键设置(鼠标滚动控制字体大小)
一.pycharm字体放大的设置 File —> setting —> Keymap —>在搜寻框中输入:increase —> Increase Font Size(双击) ...