Friday 16:25–18:00 in LG6

Ten Steps to Keras

Valerio Maggio

Audience level:


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

Outline (in ten Notebooks)

  1. Multi-layer Fully Connected Networks (and the backends)
  2. Bottleneck features and Embeddings
  3. Convolutional Networks
  4. Transfer Learning and Fine Tuning
  5. Residual Networks
  6. Recursive Neural Networks
  7. [Variational] AutoEncoders and Adversarials
  8. Multi-Modal Networks
  9. Custom Layers and Optimisers
  10. Interactive Networks and Callbacks


  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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)

  7. [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.

  8. 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.

  9. 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.

  10. 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:

(Optional but recommended):

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.