深度学习框架keras安装(后端基于Tensorflow/theano)

1、安装python3、tensorflow、numpy、scipy

安装python3及开发工具

sudo apt-get install python3
sudo apt-get install python-setuptools

安装pip

sudo apt-get install python3-pip

安装tensorflow/numpy/scipy

pip3 install numpy
pip3 install scipy
pip3 install tensorflow

2、安装keras

pip3 install keras

3、安装成功之后的效果

ubuntu:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import keras
Using TensorFlow backend.
>>> exit()

修改keras配置文件,可以更改keras后端依赖的框架:
vim ~/.keras/keras.json

{
    "image_data_format": "channels_last",
    "epsilon": 1e-07,
    "backend": "tensorflow",
    "floatx": "float32"
}

把tensorflow改为theano,
同时把channels_last改为channels_first,
即可切换后端框架,如下:

{
    "image_data_format": "channels_first",
    "epsilon": 1e-07,
    "backend": "theano",
    "floatx": "float32"
}

你可能感兴趣的:(TensorFlow,MachineLearning,深度学习,python,keras)