Slide 1

Slide 1 text

DEEP LEARNING ATLAS Introduction to Neural Networks Michał Karzyński • 4Developers 2019

Slide 2

Slide 2 text

ABOUT THIS TALK • What are neural networks? • How do they learn? • Convolutional Neural Networks (CNNs) • Recurrent neural networks (RNNs) • Generative adversarial networks (GANs)

Slide 3

Slide 3 text

ABOUT ME • Michał Karzyński (@postrational) • Full stack geek (C++, Python, JavaScript) • I blog at http://michal.karzynski.pl • I’m a tech lead at working on

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

WHAT IS A NEURAL NETWORK?

Slide 6

Slide 6 text

A universal function approximator.

Slide 7

Slide 7 text

WHAT IS A FUNCTION? Input Output Function (mapping)

Slide 8

Slide 8 text

WHAT IS A FUNCTION? Hotdog Not Hotdog Function (mapping)

Slide 9

Slide 9 text

NEURAL NETWORK 
 CAN APPROXIMATE ANY FUNCTION Hotdog Not Hotdog 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦

Slide 10

Slide 10 text

WHAT IS A NEURAL NETWORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ 1 Input Layer Hidden Layer Bias Output Layer

Slide 11

Slide 11 text

1 b W HOW DO NEURAL NETWORKS WORK? 1 1 ⦦ ⦦ ⦦ Hotdog Not hotdog 0 10 255 168 x ⦦ ⦦ ⦦

Slide 12

Slide 12 text

1 b W HOW DO NEURAL NETWORKS WORK? 1 1 ⦦ ⦦ ⦦ Hotdog Not hotdog 0 10 255 168 n ∑ i=1 wi xi + b x ⦦ ⦦ ⦦

Slide 13

Slide 13 text

ACTIVATION FUNCTIONS ReLU 0 1,5 3 4,5 6 -6 -3 0 3 6 Sigmoid 0 0,25 0,5 0,75 1 -6 -3 0 3 6 Tanh -1 -0,5 0 0,5 1 -6 -3 0 3 6

Slide 14

Slide 14 text

HOW DO NEURAL NETWORKS WORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog 0 10 255 168 ReLU ( n ∑ i=1 wi xi + b )

Slide 15

Slide 15 text

HOW DO NEURAL NETWORKS WORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog 0 10 255 168

Slide 16

Slide 16 text

HOW DO NEURAL NETWORKS WORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog 0.10 0.90 Prediction 0 10 255 168

Slide 17

Slide 17 text

HOW DO NEURAL NETWORKS LEARN?

Slide 18

Slide 18 text

INFERENCE TRAINING

Slide 19

Slide 19 text

HOW DO NEURAL NETWORKS LEARN? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog 0.50 0.90 Prediction 0 10 255 168

Slide 20

Slide 20 text

HOW DO NEURAL NETWORKS LEARN? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog 0.50 0 0.90 1 Prediction G round truth 0 10 255 168

Slide 21

Slide 21 text

HOW DO NEURAL NETWORKS LEARN? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog ⏐0.50 - 0⏐ = 0.50 ⏐0.90 - 1⏐ = 0.10 0.60 Prediction G round truth Loss 0 10 255 168

Slide 22

Slide 22 text

HOW DO NEURAL NETWORKS LEARN? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog ⏐0.55 - 0⏐ = 0.55 ⏐0.85 - 1⏐ = 0.15 0.70 Prediction G round truth Loss 0 10 255 168

Slide 23

Slide 23 text

HOW DO NEURAL NETWORKS LEARN? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog ⏐0.45 - 0⏐ = 0.45 ⏐0.95 - 1⏐ = 0.05 0.50 Prediction G round truth Loss 0 10 255 168

Slide 24

Slide 24 text

HOW DO NEURAL NETWORKS LEARN? • Backpropagation - calculate the gradients using derivatives • Stochastic gradient descent - use gradients to adjust weights

Slide 25

Slide 25 text

BACKPROPAGATION 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog ⏐0.45 - 0⏐ = 0.45 ⏐0.95 - 1⏐ = 0.05 0.50 Prediction G round truth Loss 0 10 255 168 ∇W3 = dLoss dW3 ∇W2 = dLoss dW2 ∇W1 = dLoss dW1

Slide 26

Slide 26 text

BACKPROPAGATION 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ Hotdog Not hotdog ⏐0.45 - 0⏐ = 0.45 ⏐0.95 - 1⏐ = 0.05 0.50 Prediction G round truth Loss 0 10 255 168 ∇W3 ∇W2 ∇W1

Slide 27

Slide 27 text

STOCHASTIC GRADIENT DESCENT one step per mini-batch

Slide 28

Slide 28 text

CONVOLUTIONAL NEURAL NETWORKS

Slide 29

Slide 29 text

WHAT IS A NEURAL NETWORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ 1 Input Layer Hidden Layer Bias Output Layer

Slide 30

Slide 30 text

CONVOLUTIONAL NEURAL NETWORK 1 1 1 ⦦ ⦦ ⦦ ⦦ 1 Input Layer Fully-connected Bias Output Layer Convolutional layer

Slide 31

Slide 31 text

CONVOLUTION OPERATION Input image Weights ∗ = Output image

Slide 32

Slide 32 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 Input data Sobel filter ∗ =

Slide 33

Slide 33 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 Input data Sobel filter ∗ = ∑ m ∑ n I(m,n) K(m,n)

Slide 34

Slide 34 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 20 Input data Sobel filter ∗ =

Slide 35

Slide 35 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 20 20 Input data Sobel filter ∗ =

Slide 36

Slide 36 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 20 20 0 Input data Sobel filter ∗ =

Slide 37

Slide 37 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 20 20 0 0 ... Input data Sobel filter ∗ =

Slide 38

Slide 38 text

DETECT VERTICAL EDGES 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 1 0 -1 2 0 -2 1 0 -1 0 20 20 0 0 20 20 0 0 20 20 0 0 20 20 0 Input data Sobel filter Feature map ∗ =

Slide 39

Slide 39 text

USING MULTIPLE FILTERS 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 5 5 5 0 0 0 Feature map 1 ∗ = Feature map 2

Slide 40

Slide 40 text

LEARNING MULTIPLE FILTERS [Krizhevsky et al., NIPS'12]

Slide 41

Slide 41 text

CONVOLUTIONAL NETWORK: VGG-16 224x224x3 Convolution & ReLU Max Pooling Fully Connected & ReLU FC + SoftMax 224x224x64 112x112x128 56x56x256 28x28x512 14x14x512 7x7x512 4096 1000 112x112x64 56x56x128 28x28x256 14x14x512

Slide 42

Slide 42 text

VISUALIZATION OF CONVOLUTIONAL NETWORKS [Zeiler and Fergus, ECCV 2014]

Slide 43

Slide 43 text

VISUALIZATION OF CONVOLUTIONAL NETWORKS [Zeiler and Fergus, ECCV 2014]

Slide 44

Slide 44 text

[Zeiler and Fergus, ECCV 2014]

Slide 45

Slide 45 text

APPLICATIONS OF CNNS • Image recognition • Facial recognition • Detecting objects in an image • Handwriting recognition • Video analysis • Drug discovery • Medical diagnostics

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

RECURRENT NEURAL NETWORKS

Slide 48

Slide 48 text

WHAT IS A NEURAL NETWORK? 1 1 1 ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ ⦦ 1 Input Layer Hidden Layer Bias Output Layer b W1 x W2 W3 ^ y

Slide 49

Slide 49 text

WHAT IS A NEURAL NETWORK? Input Layer Hidden Layer Output Layer W1 x W2 W3 ^ y

Slide 50

Slide 50 text

RECURRENT NEURAL NETWORKS (WORKING WITH SEQUENCES) xt WI ^ yt Wy WR xt WI ^ yt Wy xt+1 WI ^ yt+1 Wy xt+2 WI ^ yt+2 Wy WR WR

Slide 51

Slide 51 text

RECURRENT NEURAL NETWORKS 1 0 0 0 "e" 0 0 1 0 "l" 0 0 1 0 "l" e 0 h 1 l 0 o 0 "h" = "h" 0 1 0 0 0.7 0.1 0.1 0.1 "e" 0.2 0.2 0.4 0.2 "l" 0.1 0.0 0.9 0.0 "l" 0.1 0.1 0.1 0.7 "o"

Slide 52

Slide 52 text

RECURRENT NEURAL NETWORKS Naturalism and decision for the majority of Arab countries' capitalide was grounded by the Irish language by [[John Clair]], [[An Imperial Japanese Revolt]], associated with Guangzham's sovereignty. His generals were the powerful ruler of the Portugal in the [[Protestant Immineners]], which could be said to be directly in Cantonese Communication, which followed a ceremony and set inspired prison, training. The emperor travelled back to [[Antioch, Perth, October 25|21]] to note, the Kingdom of Costa Rica, unsuccessful fashioned the [[Thrales]], [[Cynth's Dajoard]], known in western [[Scotland]], near Italy to the conquest of India with the conflict. [http://karpathy.github.io/2015/05/21/rnn-effectiveness/]

Slide 53

Slide 53 text

RECURRENT NEURAL NETWORKS this movie was really good positive 0.81 negative 0.19

Slide 54

Slide 54 text

RECURRENT NEURAL NETWORKS he learned about neural networks uczył się o sieciach neuronowych

Slide 55

Slide 55 text

APPLICATIONS OF RNNS • Language modelling • Machine translation • Speech recognition • Music composition • Time series prediction • Human action recognition • Protein homology detection

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

HIGHER-ORDER NETWORKS

Slide 58

Slide 58 text

VIDEO CAPTIONING NETWORK Conv Conv Conv Conv people racing to the top of sand dunes

Slide 59

Slide 59 text

GENERATIVE ADVERSARIAL NETWORKS Conv Random noise Deconvolution real 0.81 fake 0.19 Fake image Real images Generator Discriminator

Slide 60

Slide 60 text

this person does not exist.com

Slide 61

Slide 61 text

this person does not exist.com

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

DEEP LEARNING SPECIALIZATION ON COURSERA

Slide 64

Slide 64 text

DEEP LEARNING SOFTWARE

Slide 65

Slide 65 text

DEEP LEARNING FRAMEWORK ARCHITECTURE Python API Graph Intermediate Representation CPU GPU Accelerator Execution backends

Slide 66

Slide 66 text

ngraph.ai

Slide 67

Slide 67 text

THANK YOU michal.karzynski.pl References ImageNet Classification with Deep Convolutional Neural Networks (NIPS, 2012)
 Alex Krizhevsky, Ilya Sutskever, Geoffrey Hinton
 https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks Visualizing and Understanding Convolutional Networks (ECCV, 2014)
 Matthew Zeiler, Rob Fergus
 https://arxiv.org/abs/1311.2901 The Unreasonable Effectiveness of Recurrent Neural Networks
 Andrej Karpathy
 http://karpathy.github.io/2015/05/21/rnn-effectiveness/ Star Trek images via TrekCore.com. 
 All Star Trek trademarks and images are owned by CBS Studios Inc. Hot-dog image by TheCulinaryGeek on Flickr
 https://www.flickr.com/photos/preppybyday/ 5076302395 All other images from pexels.com
 https://www.pexels.com/ * Other names and brands may be claimed as the property of others