In this tutorial we will learn Keras in ten steps (a.k.a. Jupyter Notebooks). We will warm up by learning how to create a multi layer network, and then we will go through more sophisticated topics such as implementing different types of networks (e.g. RNN, CNN), creating custom layers and discovering Keras internals. numpy proficiency and basic knowledge of Machine/Deep Learning are assumed.
Goal of the Tutorial
Discover Keras Implementation and Internals.
Note: examples and hands-on exercises will be provided along the way.
backends
)Multi-layer Fully Connected Networks
In this notebook we will learn the basic building blocks of Keras APIs to create deep neural networks. We will learn how to use the Sequential
object as well as Functional and keras.backend
APIs. First examples of MLP and Fully Connected Networks will be presented.
Bootleneck Features and Embeddings After having played a bit with Keras APIs for building networks, we start learn how to inspect network's internals. In details, we will learn (1) how to iterate over layers; (2) how to initialise and get weights; (3) how to extract bottleneck features and create embeddings.
Convolutional Networks
This notebook will teach how to build CNN (Convolutional Neural Networks). Convolutional, Pooling, DropOut layers will be presented, along with clear description on how to properly apply convolutions on images, depending on image_dim_ordering
setting.
Transfer Learning and Fine Tuning
The Keras implementation of some famous Deep Convolutional Networks will be presented (i.e. keras.applications.vgg16
, keras.applications.vgg19
, and keras.applications.inceptionv3
). We will learn how to leverage on these models for transfer learning and fine tuning using Keras Layer
APIs.
Residual Networks
In this notebook, Residual Networks will be presented. In particular, the Keras implementation of the residual network topology will be explained. Then, ResNet (keras.applications.resnet50
) and InceptionV4 Keras implementation will be detailed.
Recursive Neural Networks
Recursive Neural Networks (i.e. LSTM and GRU) are the main topic of this notebook. The Keras implementation of these two types of network will be presented along with working examples combining Word Embeddings and Convolutional Layers (i.e. keras.layers.convolutional_recurrent
)
[Variational] AutoEncoders and Adversarials This notebook will be devoted to show how to implement AutoEncoders in Keras. In particular, the implementation of Stacked AutoEncoders, Variational AutoEncoders and Generative Adversarial Networks will be presented.
Multi-Modal Networks Multi-Input and Multi-task Networks are the fundamental steps for advanced deep networks. This notebook will provide implementation recipes and examples.
Custom Layers and Optimisers This notebook will provide details and examples of Keras internals. In particular, we will learn how to implement a Custom Layer in Keras, and custom Activation functions, and custom optimisers.
Interactive Networks and Callbacks
In this last notebook, keras.callbacks
will be explained. Callbacks to track and monitor network performances during the training process will be built and integrated inside a web app. Finally, an example of keras-js
will be described, detailing functions in Keras to export models and weights (in json
and hdf5
formats).
This tutorial requires the following packages:
Python version 3.5.x - Python 3.4 is fine as well - likely Python 2.7 would also be fine, but who knows? :P
numpy
version 1.10 or later: http://www.numpy.org/
scipy
version 0.16 or later: http://www.scipy.org/matplotlib
version 1.4 or later: http://matplotlib.org/pandas
version 0.16 or later: http://pandas.pydata.orgscikit-learn
version 0.15 or later: http://scikit-learn.orgkeras
version 1.0 or later: http://keras.iotensorflow
version 0.9 or later: https://www.tensorflow.orgipython
/jupyter
version 4.0 or later, with notebook support(Optional but recommended):
pyyaml
hdf5
and h5py
(required if you use model saving/loading functions in keras)The easiest way to get (most) these is to use an all-in-one installer such as Anaconda from Continuum. These are available for multiple architectures.