# Keras: Deep Learning for Python
![Keras logo](https://s3.amazonaws.com/keras.io/img/keras-logo-medium.png)
[![Build Status](https://travis-ci.org/fchollet/keras.svg?branch=master)](https://travis-ci.org/fchollet/keras)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/fchollet/keras/blob/master/LICENSE)
## You have just found Keras.
Keras is a high-level neural networks API, written in Python and capable of running on top of [TensorFlow](https://github.com/tensorflow/tensorflow), [CNTK](https://github.com/Microsoft/cntk), or [Theano](https://github.com/Theano/Theano). It was developed with a focus on enabling fast experimentation. *Being able to go from idea to result with the least possible delay is key to doing good research.*
Use Keras if you need a deep learning library that:
- Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility).
- Supports both convolutional networks and recurrent networks, as well as combinations of the two.
- Runs seamlessly on CPU and GPU.
Read the documentation at [Keras.io](https://keras.io).
Keras is compatible with: __Python 2.7-3.6__.
------------------
## Guiding principles
- __User friendliness.__ Keras is an API designed for human beings, not machines. It puts user experience front and center. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number of user actions required for common use cases, and it provides clear and actionable feedback upon user error.
- __Modularity.__ A model is understood as a sequence or a graph of standalone, fully-configurable modules that can be plugged together with as little restrictions as possible. In particular, neural layers, cost functions, optimizers, initialization schemes, activation functions, regularization schemes are all standalone modules that you can combine to create new models.
- __Easy extensibility.__ New modules are simple to add (as new classes and functions), and existing modules provide ample examples. To be able to easily create new modules allows for total expressiveness, making Keras suitable for advanced research.
- __Work with Python__. No separate models configuration files in a declarative format. Models are described in Python code, which is compact, easier to debug, and allows for ease of extensibility.
------------------
## Getting started: 30 seconds to Keras
The core data structure of Keras is a __model__, a way to organize layers. The simplest type of model is the [`Sequential`](https://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras functional API](https://keras.io/getting-started/functional-api-guide), which allows to build arbitrary graphs of layers.
Here is the `Sequential` model:
```python
from keras.models import Sequential
model = Sequential()
```
Stacking layers is as easy as `.add()`:
```python
from keras.layers import Dense, Activation
model.add(Dense(units=64, input_dim=100))
model.add(Activation('relu'))
model.add(Dense(units=10))
model.add(Activation('softmax'))
```
Once your model looks good, configure its learning process with `.compile()`:
```python
model.compile(loss='categorical_crossentropy',
optimizer='sgd',
metrics=['accuracy'])
```
If you need to, you can further configure your optimizer. A core principle of Keras is to make things reasonably simple, while allowing the user to be fully in control when they need to (the ultimate control being the easy extensibility of the source code).
```python
model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True))
```
You can now iterate on your training data in batches:
```python
# x_train and y_train are Numpy arrays --just like in the Scikit-Learn API.
model.fit(x_train, y_train, epochs=5, batch_size=32)
```
Alternatively, you can feed batches to your model manually:
```python
model.train_on_batch(x_batch, y_batch)
```
Evaluate your performance in one line:
```python
loss_and_metrics = model.evaluate(x_test, y_test, batch_size=128)
```
Or generate predictions on new data:
```python
classes = model.predict(x_test, batch_size=128)
```
Building a question answering system, an image classification model, a Neural Turing Machine, or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful?
For a more in-depth tutorial about Keras, you can check out:
- [Getting started with the Sequential model](https://keras.io/getting-started/sequential-model-guide)
- [Getting started with the functional API](https://keras.io/getting-started/functional-api-guide)
In the [examples folder](https://github.com/fchollet/keras/tree/master/examples) of the repository, you will find more advanced models: question-answering with memory networks, text generation with stacked LSTMs, etc.
------------------
## Installation
Before installing Keras, please install one of its backend engines: TensorFlow, Theano, or CNTK. We recommend the TensorFlow backend.
- [TensorFlow installation instructions](https://www.tensorflow.org/install/).
- [Theano installation instructions](http://deeplearning.net/software/theano/install.html#install).
- [CNTK installation instructions](https://docs.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your-machine).
You may also consider installing the following **optional dependencies**:
- cuDNN (recommended if you plan on running Keras on GPU).
- HDF5 and h5py (required if you plan on saving Keras models to disk).
- graphviz and pydot (used by [visualization utilities](https://keras.io/visualization/) to plot model graphs).
Then, you can install Keras itself. There are two ways to install Keras:
- **Install Keras from PyPI (recommended):**
```sh
sudo pip install keras
```
If you are using a virtualenv, you may want to avoid using sudo:
```sh
pip install keras
```
- **Alternatively: install Keras from the Github source:**
First, clone Keras using `git`:
```sh
git clone https://github.com/fchollet/keras.git
```
Then, `cd` to the Keras folder and run the install command:
```sh
cd keras
sudo python setup.py install
```
------------------
## Switching from TensorFlow to CNTK or Theano
By default, Keras will use TensorFlow as its tensor manipulation library. [Follow these instructions](https://keras.io/backend/) to configure the Keras backend.
------------------
## Support
You can ask questions and join the development discussion:
- On the [Keras Google group](https://groups.google.com/forum/#!forum/keras-users).
- On the [Keras Slack channel](https://kerasteam.slack.com). Use [this link](https://keras-slack-autojoin.herokuapp.com/) to request an invitation to the channel.
You can also post **bug reports and feature requests** (only) in [Github issues](https://github.com/fchollet/keras/issues). Make sure to read [our guidelines](https://github.com/fchollet/keras/blob/master/CONTRIBUTING.md) first.
------------------
## Why this name, Keras?
Keras (κέρας) means _horn_ in Greek. It is a reference to a literary image from ancient Greek and Latin literature, first found in the _Odyssey_, where dream spirits (_Oneiroi_, singular _Oneiros_) are divided between those who deceive men with false visions, who arrive to Earth through a gate of ivory, and those who announce a future that will come to pass, who arrive through a gate of horn. It's a play on the words κέρας (horn) / κραίνω (fulfill), and ἐλέφας (ivory) / ἐλεφαίρομαι (deceive).
Keras was initially developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System).
>_"Oneiroi are beyond our unravelling --who can be sure what tale they tell? Not all that m
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Keras-2.0.9.tar.gz (197个子文件)
setup.cfg 79B
MANIFEST.in 72B
LICENSE 2KB
faq.md 22KB
applications.md 22KB
functional-api-guide.md 16KB
sequential-model-guide.md 13KB
image.md 11KB
README.md 8KB
datasets.md 7KB
text.md 5KB
backend.md 4KB
README.md 4KB
sequence.md 4KB
callbacks.md 2KB
scikit-learn-api.md 2KB
about-keras-models.md 2KB
writing-your-own-keras-layers.md 2KB
regularizers.md 1KB
metrics.md 1KB
losses.md 1KB
about-keras-layers.md 1KB
optimizers.md 1KB
initializers.md 1KB
activations.md 943B
model.md 892B
constraints.md 833B
visualization.md 785B
README.md 475B
sequential.md 281B
index.md 60B
PKG-INFO 910B
PKG-INFO 910B
topology.py 130KB
tensorflow_backend.py 120KB
training.py 105KB
convolutional.py 92KB
recurrent.py 88KB
theano_backend.py 82KB
cntk_backend.py 76KB
models.py 63KB
backend_test.py 58KB
layers.py 49KB
image.py 46KB
interface_test.py 44KB
callbacks.py 40KB
test_training.py 35KB
convolutional_test.py 35KB
core.py 34KB
test_callbacks.py 31KB
interfaces.py 29KB
mobilenet.py 28KB
test_topology.py 27KB
pooling.py 26KB
optimizers.py 26KB
recurrent_test.py 26KB
convolutional_recurrent.py 26KB
merge.py 23KB
cudnn_recurrent.py 22KB
data_utils.py 22KB
image_ocr.py 21KB
local.py 18KB
autogen.py 17KB
mnist_net2net.py 16KB
initializers.py 15KB
inception_resnet_v2.py 15KB
image_test.py 15KB
inception_v3.py 14KB
neural_doodle.py 14KB
applications_test.py 14KB
generic_utils.py 14KB
cudnn_recurrent_test.py 13KB
wrappers.py 13KB
scikit_learn.py 12KB
layers_test.py 12KB
xception.py 12KB
text.py 12KB
resnet50.py 11KB
mnist_acgan.py 11KB
test_sequential_model.py 11KB
test_loss_weighting.py 11KB
test_model_saving.py 10KB
neural_style_transfer.py 10KB
models_test.py 10KB
test_multiprocessing.py 9KB
normalization.py 9KB
lstm_seq2seq.py 9KB
test_temporal_data_tasks.py 9KB
merge_test.py 9KB
babi_rnn.py 9KB
vgg19.py 9KB
layer_utils.py 8KB
vgg16.py 8KB
babi_memnn.py 8KB
data_utils_test.py 8KB
wrappers_test.py 8KB
lstm_stateful.py 8KB
sequence.py 8KB
imagenet_utils.py 8KB
mnist_swwae.py 8KB
共 197 条
- 1
- 2
资源评论
假技术po主
- 粉丝: 516
- 资源: 4248
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功