Introduction To Keras
Introduction To Keras
Introduction To Keras
2
Keras: The python deep learning library
High-level neural network API.
Written in Python.
TensorFlow absorved keras.
3
Keras: The python deep learning library
High-level neural network API.
Written in Python.
TensorFlow absorved keras.
Developed with a focus on enabling fast experimentation.
4
Keras: Install…
Anaconda Environment
Windows: Running the file (*.exe) available at:
https://www.anaconda.com/download/
Linux: Running trough the bash command in the terminal the file available
in the same link.
5
Keras: Install…
Using the Anaconda environment:
Install the packages tensorflow and keras:
conda install -c anaconda tensorflow
conda install -c anaconda keras (using tensorflow as backend)
In general, the packages can be installed:
conda install –c conda package_name
More information at:
https://keras.io/
6
Keras: Layers
Input:
input_img = Input(shape=(rows , cols , channels))
Dense:
x = Dense(num_of_units , activation=‘activation_function’)
Conv2D:
x = Conv2D(num_of_filters, kernel_size , stride,
activation=‘activation_function’,padding=‘type_of_padding’)
MaxPool2D:
x = MaxPool2D(kernel_size)
Flatten:
Dropout:
x = Dropout(value_of_dropout)
7
Keras: Optimizers
SGD
RMSProp
AdaGrad
Adam
…
8
Keras: Activation Functions
Sigmoid
Tanh
Relu
LeakyRelu
ELU
Softmax
…
9
Keras: Cost Functions
Mean Squared Error (‘mse’)
…
10
Keras: Defining the architecture
There are two ways to define the architecture:
11
Keras: Defining the architecture
There are two ways to define the architecture:
12
Exercises:
Exercise 1:
Define the network architecture following the LeNet-5 model.
Exercise 2:
Evaluate the network performance in terms of accuracy in relation to the
change of:
1. Learning rate: 0.1 and 0.001.
2. Activation functions: ReLU and Sigmoid.
3. Dropout values: 0.25, 0.5 and 0.75
13
INTRODUCTION TO KERAS