keras Getting started with keras Installation and Setup

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Keras is a high-level neural networks library, written in Python and capable of running on top of either TensorFlow 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. Use Keras if you need a deep learning library that:

  • Allows for easy and fast prototyping (through total modularity, minimalism, and extensibility).
  • Supports both convolutional networks and recurrent networks, as well as combinations of the two.
  • Supports arbitrary connectivity schemes (including multi-input and multi-output training).
  • Runs seamlessly on CPU and GPU.

Installation

Keras uses the following dependencies:

  • numpy, scipy
  • pyyaml
  • HDF5 and h5py (optional, required if you use model saving/loading functions)
  • Optional but recommended if you use CNNs: cuDNN
  • scikit-image (optional, required if you use keras built-in functions for preprocessing and augmenting image data)

Keras is a high-level library that provides a convenient Machine Learning API on top of other low-level libraries for tensor processing and manipulation, called Backends. At this time, Keras can be used on top any of the three available backends: TensorFlow, Theano, and CNTK.

Theano is installed automatically if you install Keras using pip. If you want to install Theano manually, please refer to Theano installation instructions.

TensorFlow is a recommended option, and by default, Keras uses TensorFlow backend, if available. To install TensorFlow, the easiest way is to do

$ pip install tensorflow

If you want to install it manually, please refer to TensorFlow installation instructions.

To install Keras, cd to the Keras folder and run the install command:

$ python setup.py install

You can also install Keras from PyPI:

$ pip install keras

Configuration

If you have run Keras at least once, you will find the Keras configuration file at:

~/.keras/keras.json

If it isn't there, you can create it. The default configuration file looks like this:

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

Switching from TensorFlow to Theano

By default, Keras will use TensorFlow as its tensor manipulation library. If you want to use other backend, simply change the field backend to either "theano" or "tensorflow", and Keras will use the new configuration next time you run any Keras code.



Got any keras Question?