- Open Source, High-Level deep-learning library in python
- Sits on top of your normal deep-learning framework (tensorflow, theano, MXNet, CNTK etc)
Why Keras?
- Allows you to build most model architectures very quickly
- Removes the tedium of lower-level coding e.g.
- No handling of tensorflow session
- No keeping track of matrix sizes
- No management of weights and biases
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Great documentation at keras.io
Since 2017 keras is integrated as
part of tensorflow core
Large user base and good online support
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Raw Tensorflow 2 convolutional layers
And now with Keras
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Raw Tensorflow - Adding a Dense Layer
And now with Keras
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Raw Tensorflow - Loss and Optimizer
And now with Keras
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Raw Tensorflow - Training
And now with Keras
Note on "epochs":
An epoch (in keras case) implies a run through the entire dataset (55,000 images).
In tensorflow we made 20,000 iterations over batches of size 50. This equates to 1,000,000 training samples.
In keras to use 1,000,000 training samples we will need to run through the entire dataset (1,000,000 / 55.000) times which is ~= 18 times (18 epochs)
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Raw Tensorflow - Testing
And now with Keras
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin
Equivalent code in keras
Code to build, train and print accuracy of our network
(tensorflow)
Keelin Murphy
Courtesy Keelin Murphy
@MurphyKeelin