安装Keras(TensorFlow做后端)

在前文TensorFlow练习1中我提到过一个使用TensorFlow做后端的高级库,这个库叫Keras,它是一个抽象层次比较高的神经网络Python库。在TensorFlow练习1中我是手动定义神经网络,有了这货几行代码就可搞定。

最开始Keras使用Theano做为后端,TensorFlow火了以后,Keras又添加了TensorFlow支持

本帖记录了安装Keras的步骤,并使用TensorFlow做后端。(使用的系统是Ubuntu)。

1 安装TensorFlow
$  pip install  --upgrade  <tensorflow_url>
2 安装Keras
$ pip install numpy scipy
$ pip install scikit-learn
$ pip install pillow
$ pip install h5py
$ pip install keras

执行:

$  python
>>>  import keras

编辑配置文件keras.json:

~/.keras/keras.json

确保内容为:

{
    "image_dim_ordering": "tf", 
    "epsilon": 1e-07, 
    "floatx": "float32", 
    "backend": "tensorflow"
}

image_dim_ordering:TensorFlow是使用NumPy数组 (height, width, depth)。如果你用Theano,数组表示方法(depth, height, width)。

安装Keras(TensorFlow做后端)

来源:http://blog.topspeedsnail.com/archives/10427

猜你喜欢

转载自blog.csdn.net/xc_zhou/article/details/88538929