翻译自:https://github.com/keras-team/kerasKeras: Deep Learning for humansYou have just found Keras.你刚刚找到keras。Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or 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. Keras是一个高级神经网络API,用Python编写,能够在TensorFlow,CNTK或Theano之上运行。 它的开发着重于实现快速实验。 能够以最少的可能延迟从想法到结果是做好研究的关键。 Use Keras if you need a deep learning library that: 如果您需要深度学习库,请使用Keras:
Read the documentation at Keras.io. 阅读Keras.io的文档。 Keras is compatible with: Python 2.7-3.6. Keras兼容:Python 2.7-3.6。 Guiding principles指导原则
Getting started: 30 seconds to Keras开始:keras 30秒 The core data structure of Keras is a model, a way to organize layers. The simplest type of model is the Keras的核心数据结构是一种模型,一种组织图层的方法。 最简单的模型是Sequential模型,这是一个线性堆叠层。 对于更复杂的体系结构,您应该使用Keras功能API,它允许构建任意图层的图层。 Here is the 这是Sequential模型: from keras.models import Sequential
model = Sequential() Stacking layers is as easy as 堆叠图层如.add()一样简单: from keras.layers import Dense
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax')) Once your model looks good, configure its learning process with 一旦你的模型看起来不错,用.compile()配置它的学习过程: 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). 如果你需要,你可以进一步配置你的优化器。 Keras的核心原则是使事情变得相当简单,同时允许用户在需要时能够完全控制(最终控制是源代码的易扩展性)。 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: 您现在可以批量迭代您的训练数据: # 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: 或者,您可以手动将批次供应给您的模型: model.train_on_batch(x_batch, y_batch) Evaluate your performance in one line: 在一行中评估你的表现: loss_and_metrics = model.evaluate(x_test, y_test, batch_size=128) Or generate predictions on new data: 或者对新数据产生预测: 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: 有关Keras的更深入的教程,您可以查看:
In the examples folder of the repository, you will find more advanced models: question-answering with memory networks, text generation with stacked LSTMs, etc. 在存储库的examples文件夹中,您可以找到更多高级模型:使用内存网络回答问题,使用堆叠LSTM生成文本等。 InstallationBefore installing Keras, please install one of its backend engines: TensorFlow, Theano, or CNTK. We recommend the TensorFlow backend. 在安装Keras之前,请安装其后端引擎之一:TensorFlow,Theano或CNTK。 我们推荐TensorFlow后端。
You may also consider installing the following optional dependencies: 您也可以考虑安装以下可选依赖项:
Then, you can install Keras itself. There are two ways to install Keras: 然后,您可以安装Keras本身。 有两种方法可以安装Keras:
sudo pip install keras If you are using a virtualenv, you may want to avoid using sudo: 如果你使用的是virtualenv,你可能想避免使用sudo: pip install keras
First, clone Keras using git clone https://github.com/keras-team/keras.git Then, 然后,cd到Keras文件夹并运行安装命令: cd keras
sudo python setup.py install Configuring your Keras backend配置您的Keras后端 By default, Keras will use TensorFlow as its tensor manipulation library. Follow these instructions to configure the Keras backend. 默认情况下,Keras将使用TensorFlow作为张量操作库。 按照这些说明配置Keras后端。 SupportYou can ask questions and join the development discussion: 您可以提出问题并加入开发讨论:
You can also post bug reports and feature requests (only) in GitHub issues. Make sure to read our guidelines first. 您也可以在GitHub问题中发布错误报告和功能请求(仅)。 请务必先阅读我们的指南。 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(κέρας)意为希腊语中的号角。 它是从古希腊和拉丁文学中提及的一种文学形象,首次在奥德赛发现,那里的梦幻灵魂(Oneiroi,单一的Oneiros)被分为那些用假象来欺骗人类,通过象牙门到达地球的人 ,还有那些宣布未来将要来临的人们,他们从喇叭口到达。 这是一个关于κέρας(horn)/κραίνω(履行)和ἐλέφας(象牙)/ἐλεφαίρομαι(欺骗)这两个词的游戏。 Keras was initially developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System). Keras最初是作为项目ONEIROS(开放式神经电子智能机器人操作系统)研究工作的一部分而开发的。
|
|