keras 切换后端 TensorFlow,cntk,theano
参考
https://keras.io/#configuring-your-keras-backend
Switching from one backend to another
If you have run Keras at least once, you will find the Keras configuration file at:
$HOME/.keras/keras.json
If it isn't there, you can create it.
linux
~/.keras/目录下 keras.json文件 如果不存在可以手动创建
windows
在系统盘中用户(users)当前用户名下的.keras文件夹中,有个keras.json文件。
打开后更改"backend": "xxxxxx"
xxxxx表示需要更换的后端,如"theano", "tensorflow", or "cntk",
NOTE for Windows Users: Please replace $HOME with %USERPROFILE%.
The default configuration file looks like this:
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
Simply change the field backend to "theano", "tensorflow", or "cntk", and Keras will use the new configuration next time you run any Keras code.
You can also define the environment variable KERAS_BACKEND and this will override what is defined in your config file :
KERAS_BACKEND=tensorflow python -c "from keras import backend"
Using TensorFlow backend.
In Keras it is possible to load more backends than "tensorflow", "theano", and "cntk". Keras can use external backends as well, and this can be performed by changing the keras.json configuration file, and the "backend" setting. Suppose you have a Python module called my_module that you wanted to use as your external backend. The keras.json configuration file would be changed as follows:
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "my_package.my_module"
}
An external backend must be validated in order to be used, a valid backend must have the following functions: placeholder, variable and function.
If an external backend is not valid due to missing a required entry, an error will be logged notifying which entry/entries are missing.
keras.json details
The keras.json configuration file contains the following settings:
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
You can change these settings by editing $HOME/.keras/keras.json.
image_data_format: String, either"channels_last"or"channels_first". It specifies which data format convention Keras will follow. (keras.backend.image_data_format()returns it.)- For 2D data (e.g. image),
"channels_last"assumes(rows, cols, channels)while"channels_first"assumes(channels, rows, cols). - For 3D data,
"channels_last"assumes(conv_dim1, conv_dim2, conv_dim3, channels)while"channels_first"assumes(channels, conv_dim1, conv_dim2, conv_dim3). epsilon: Float, a numeric fuzzing constant used to avoid dividing by zero in some operations.floatx: String,"float16","float32", or"float64". Default float precision.backend: String,"tensorflow","theano", or"cntk".
keras 切换后端 TensorFlow,cntk,theano的更多相关文章
- 常用深度学习框架(keras,pytorch.cntk,theano)conda 安装--未整理
版本查询 cpu tensorflow conda env list source activate tensorflow python import tensorflow as tf 和 tf.__ ...
- 深度学习框架比较TensorFlow、Theano、Caffe、SciKit-learn、Keras
TheanoTheano在深度学习框架中是祖师级的存在.Theano基于Python语言开发的,是一个擅长处理多维数组的库,这一点和numpy很像.当与其他深度学习库结合起来,它十分适合数据探索.它为 ...
- 关于深度学习框架 TensorFlow、Theano 和 Keras
[TensorFlow] ——( https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/) 1.TensorFlow是啥 ...
- cpu、gpu 安装框架pytorch,cntk,theano及测试
一,cpu 下安装 tensorflow conda env list source activate tensorflow 直接安装相应版本 python import tensorflow as ...
- Deploying Keras model on Tensorflow Serving--
keras训练了个二分类的模型.需求是把keras模型跑到 tensorflow serving上 (TensorFlow Serving 系统用于在生产环境中运行模型) keras模型转 tenso ...
- Comparing deep learning frameworks: Tensorflow, CNTK, MXNet, & Caffe
https://imaginghub.com/blog/10-a-comparison-of-four-deep-learning-frameworks-tensorflow-cntk-mxnet-a ...
- 转:【AI每日播报】从TensorFlow到Theano:横向对比七大深度学习框架
http://geek.csdn.net/news/detail/139235 说到近期的深度学习框架,TensorFlow火的不得了,虽说有专家在朋友圈大声呼吁,不能让TensorFlow形成垄断地 ...
- 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 forma ...
- Keras:基于Theano和TensorFlow的深度学习库
catalogue . 引言 . 一些基本概念 . Sequential模型 . 泛型模型 . 常用层 . 卷积层 . 池化层 . 递归层Recurrent . 嵌入层 Embedding 1. 引言 ...
随机推荐
- 三种实现PHP伪静态页面的方法
PHP伪静态写法--其一 伪静态又名:URL重写 主要是为了SEO而生的.(SEO是什么?这个不用问我吧.呵呵-搞网络的不懂SEO那就----) 方法一: 比如这个网页 /soft.php/1,10 ...
- 阶段5 3.微服务项目【学成在线】_day09 课程预览 Eureka Feign_12-课程预览功能开发-需求分析
5 课程预览功能开发 5.1 需求分析 课程预览功能将使用cms系统提供的页面预览功能,业务流程如下: 1.用户进入课程管理页面,点击课程预览,请求到课程管理服务 2.课程管理服务远程调用cms添加页 ...
- 阶段5 3.微服务项目【学成在线】_day16 Spring Security Oauth2_01-用户认证需求分析
1.1 用户认证与授权 截至目前,项目已经完成了在线学习功能,用户通过在线学习页面点播视频进行学习.如何去记录学生的学习过程 呢?要想掌握学生的学习情况就需要知道用户的身份信息,记录哪个用户在什么时间 ...
- Arduino---HC-05 蓝牙模块
蓝牙基础知识回顾: (一)Arduino和HC-05连接 注意:Arduino通过TX与HC-05进行通信,而Arduino的电压为5V,HC-05的允许电压为3.3V.短时间通信无妨(长时间可能烧毁 ...
- 学习TypeScript 笔记
TypeScript 什么是TypeScript TypeScript 是 JavaScript 的一个超集,支持 ECMAScript 6 标准. TypeScript 由微软开发的自由和开源的编程 ...
- 123457123457#1#-----com.threeapp.ErTongHuaXue01----儿童滑雪大冒险
123456123456#0#-----com.threeapp.ErTongHuaXue01----儿童滑雪大冒险
- 123456---com.twoapp.ErTongNongChangPinTu---儿童农场拼图
com.twoapp.ErTongNongChangPinTu---儿童农场拼图
- 设置Android模拟器的窗口大小
Android SDK 中两个位置可以设置Android模拟器的窗口大小 1.设置Android模拟器的分辨率 Android Virtual Device Manager中创建AVD时,窗口中部Re ...
- iOS-NSBundle、NSArray、NSDictionay
NSBundle.NSArray.NSDictionay 读取plist文件 NSDictionary *dict= [NSDictionary dictionaryWithContentsOfFi ...
- sonar:windows重启sonar
登录后操作