keras环境搭建

来源:互联网 发布:淘宝客是做什么的 编辑:程序博客网 时间:2024/06/10 22:30

ubuntu下安装深度学习python工具包keras

最近一直在学习深度学习,开始用过matlab的工具箱,感觉很多功能不够,发现基于python的工具箱很多,找了一下发现Theano是使用比较多的一个,但是比较老,模块化也不够。经过别人的推荐开始使用基于Theano的一个深度学习的工具包Keras。

1.Keras简介

Keras是基于Theano的一个深度学习框架,它的设计参考了Torch,用Python语言编写,是一个高度模块化的神经网络库,支持GPU和CPU。使用文档在这: http://keras.io/,这个框架貌似是刚刚火起来的,使用上的问题可以到github提issue:https://github.com/fchollet/keras 

2.Ubuntu下Keras的安装

参照keras官网给出的安装方法http://keras.io/

  从这里我们可以看到要安装keras我们还必须先安装其他几个python库。
- 安装Theano
先安装theano是因为numpy和scipy可以在这个过程一起安装。
参照theano在ubuntu下的安装指南http://deeplearning.net/software/theano/install_ubuntu.html#install-ubuntu
打开终端输入命令:

sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev gitsudo pip install Theano

第一条命令主要是安装Theano需要的扩展库,第二条是安装Theano。
- 安装pyyaml
打开终端输入命令:

sudo pip install pyyaml

可以看到还有两个可选的库,建议安装HDF5和h5py,至于cuDNN根据你自己的情况而定。
打开终端输入命令:

sudo apt-get install libhdf5-serial-devsudo pip install h5py

到这里所有的库已经安装完毕。
- 安装Keras
打开终端输入命令

sudo pip install kears

- 测试安装是否成功

    NumPy (~30s): python -c "import numpy; numpy.test()"    SciPy (~1m): python -c "import scipy; scipy.test()"    Theano (~30m): python -c "import theano; theano.test()"

程序运行过程中会不断输出字符代表成功。

3.keras 使用

参考wepon的博客:http://blog.csdn.net/u012162613/article/details/45397033

0 0
原创粉丝点击