Deep Neural Nets and Keras Pavel Krmer 1 Data Science Summer School - - PowerPoint PPT Presentation

deep neural nets and keras
SMART_READER_LITE
LIVE PREVIEW

Deep Neural Nets and Keras Pavel Krmer 1 Data Science Summer School - - PowerPoint PPT Presentation

Deep Neural Nets and Keras Pavel Krmer 1 Data Science Summer School @ Uni Vienna 1 Dept. of Computer Science, VB - Technical University of Ostrava, Ostrava, Czech Republic pavel.kromer@vsb.cz Outline Keras handson About Installation


slide-1
SLIDE 1

Deep Neural Nets and Keras

Pavel Krömer1 Data Science Summer School @ Uni Vienna

  • 1Dept. of Computer Science,

VŠB - Technical University of Ostrava, Ostrava, Czech Republic pavel.kromer@vsb.cz

slide-2
SLIDE 2

Outline

About Keras Components Keras hands–on Installation Fun with puppies, kitties, and DNNs

September 04 2018, Vienna, AT 2

slide-3
SLIDE 3

About

September 04 2018, Vienna, AT 2

slide-4
SLIDE 4

Introduction

(Deep) artificial neural networks are among the most successful machine–learning models. They are universal tools that can be used for supervised and/or unsupervised learning.

September 04 2018, Vienna, AT 3

slide-5
SLIDE 5

Artificial neural networks

Artificial neural network

  • a computational model evaluating a parametric function

composed of many other parametric (sub)functions

  • composed of many information processing units, organized into

interconnected layers

  • one unit solves a linearly separable problem, i.e. draws a

hyperplane in an n−dimensional space

September 04 2018, Vienna, AT 4

slide-6
SLIDE 6

Keras

September 04 2018, Vienna, AT 4

slide-7
SLIDE 7

Keras

Keras is a high-level neural networks API written in Python.

  • easy prototyping
  • support for convolutional and recurrent nets
  • accellerated by multicore and GPU

Powered by a backend

  • Tensorflow (default)
  • Theano
  • others (CNTK)

September 04 2018, Vienna, AT 5

slide-8
SLIDE 8

Keras

Keras is a high-level neural networks API written in Python.

  • easy prototyping
  • support for convolutional and recurrent nets
  • accellerated by multicore and GPU

Powered by a backend

  • Tensorflow (default)
  • Theano
  • others (CNTK)

September 04 2018, Vienna, AT 5

slide-9
SLIDE 9

Keras

Keras is a high-level neural networks API written in Python.

  • easy prototyping
  • support for convolutional and recurrent nets
  • accellerated by multicore and GPU

Powered by a backend

  • Tensorflow (default)
  • Theano
  • others (CNTK)

September 04 2018, Vienna, AT 5

slide-10
SLIDE 10

Keras (cont.)

My favourite because

  • sufficiently high–level (for my taste)
  • allows mixing–in with the wonderfull Python ecosystem (scikit,

matplotlib, …)

  • is programmer oriented
  • well–documented, with lots of examples
  • one can cheat in it

https://s3.amazonaws.com/assets.datacamp.com/ blog_assets/Keras_Cheat_Sheet_Python.pdf

September 04 2018, Vienna, AT 6

slide-11
SLIDE 11

Keras (cont.)

My favourite because

  • sufficiently high–level (for my taste)
  • allows mixing–in with the wonderfull Python ecosystem (scikit,

matplotlib, …)

  • is programmer oriented
  • well–documented, with lots of examples
  • one can cheat in it

https://s3.amazonaws.com/assets.datacamp.com/ blog_assets/Keras_Cheat_Sheet_Python.pdf

September 04 2018, Vienna, AT 6

slide-12
SLIDE 12

Keras components

Model

  • THE (deep) neural network you want to use
  • a stack of connected layers
  • sequential API × the bare Model class

Layers

  • individual levels that define the architecture and functionality
  • f the Model
  • different types, properties, params, functions
  • Dense layers (this is the normal, fully-connected layer)
  • Convolutional layers (applies convolution operations on the

previous layer)

  • Pooling layers (used after convolutional layers)
  • Dropout layers (regularization, prevent overfitting)

September 04 2018, Vienna, AT 7

slide-13
SLIDE 13

Keras components

Model

  • THE (deep) neural network you want to use
  • a stack of connected layers
  • sequential API × the bare Model class

Layers

  • individual levels that define the architecture and functionality
  • f the Model
  • different types, properties, params, functions
  • Dense layers (this is the normal, fully-connected layer)
  • Convolutional layers (applies convolution operations on the

previous layer)

  • Pooling layers (used after convolutional layers)
  • Dropout layers (regularization, prevent overfitting)

September 04 2018, Vienna, AT 7

slide-14
SLIDE 14

Keras components (cont.)

Loss functions

  • compare the predicted output with the real output in each pass
  • f the training algorithm
  • tell the model how the weights should be updated
  • mean–squared error, cross–entropy, …

Optimizers

  • weight update strategies in the training process
  • stochastic gradient descent, RMSProp, Adagrad

September 04 2018, Vienna, AT 8

slide-15
SLIDE 15

Keras components (cont.)

Loss functions

  • compare the predicted output with the real output in each pass
  • f the training algorithm
  • tell the model how the weights should be updated
  • mean–squared error, cross–entropy, …

Optimizers

  • weight update strategies in the training process
  • stochastic gradient descent, RMSProp, Adagrad

September 04 2018, Vienna, AT 8

slide-16
SLIDE 16

Keras hands–on

September 04 2018, Vienna, AT 8

slide-17
SLIDE 17

Installation

(Fairly) easy steps

  • Get Python (Anaconda highly recommended:

https://www.anaconda.com/download/)

  • Get TensorFlow (https://www.tensorflow.org/install/)
  • Get Keras (https://keras.io/)

pip install tensorflow pip install keras pip install msgpack argparse pydot conda install keras conda install pydot

September 04 2018, Vienna, AT 9

slide-18
SLIDE 18

Installation

(Fairly) easy steps

  • Get Python (Anaconda highly recommended:

https://www.anaconda.com/download/)

  • Get TensorFlow (https://www.tensorflow.org/install/)
  • Get Keras (https://keras.io/)

pip install tensorflow pip install keras pip install msgpack argparse pydot conda install keras conda install pydot

September 04 2018, Vienna, AT 9

slide-19
SLIDE 19

Installation

(Fairly) easy steps

  • Get Python (Anaconda highly recommended:

https://www.anaconda.com/download/)

  • Get TensorFlow (https://www.tensorflow.org/install/)
  • Get Keras (https://keras.io/)

pip install tensorflow pip install keras pip install msgpack argparse pydot conda install keras conda install pydot

September 04 2018, Vienna, AT 9

slide-20
SLIDE 20

Installation

(Fairly) easy steps

  • Get Python (Anaconda highly recommended:

https://www.anaconda.com/download/)

  • Get TensorFlow (https://www.tensorflow.org/install/)
  • Get Keras (https://keras.io/)

pip install tensorflow pip install keras pip install msgpack argparse pydot conda install keras conda install pydot

September 04 2018, Vienna, AT 9

slide-21
SLIDE 21

The mother of all classification demos: cats vs. dogs

Published on Kaggle in 2014, contains 25,000 images of cats and dogs. To make it a bit harder, we use only 1000 training images of each class.

September 04 2018, Vienna, AT 10

slide-22
SLIDE 22

The mother of all classification demos: cats vs. dogs

Published on Kaggle in 2014, contains 25,000 images of cats and dogs. To make it a bit harder, we use only 1000 training images of each class.

September 04 2018, Vienna, AT 10

slide-23
SLIDE 23

The mother of all classification demos: cats vs. dogs

Published on Kaggle in 2014, contains 25,000 images of cats and dogs. To make it a bit harder, we use only 1000 training images of each class.

September 04 2018, Vienna, AT 10

slide-24
SLIDE 24

Computer demo … https://goo.gl/M5ShF3

slide-25
SLIDE 25

From scratchTM

10 20 30 40 50 0.5 0.6 0.7 0.8 0.9 1 Epoch Accurracy training validation

September 04 2018, Vienna, AT 11

slide-26
SLIDE 26

From scratchTM

September 04 2018, Vienna, AT 12

slide-27
SLIDE 27

VGG16 / ImageNet

10 20 30 40 50 0.5 0.6 0.7 0.8 0.9 1 Epoch Accurracy training validation

September 04 2018, Vienna, AT 13

slide-28
SLIDE 28

What VGG16 dreams about?

September 04 2018, Vienna, AT 14

slide-29
SLIDE 29

What VGG16 dreams about?

September 04 2018, Vienna, AT 14