demystifying deep learning...4 deep learning model learns to perform classification tasks directly...

41
1 © 2015 The MathWorks, Inc. Demystifying Deep Learning Emelie Andersson

Upload: others

Post on 08-Apr-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

1© 2015 The MathWorks, Inc.

Demystifying Deep Learning

Emelie Andersson

Page 2: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

2

Page 3: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

3

What is Deep Learning?

Page 4: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

4

Deep Learning

Model learns to perform classification tasks directly from data.

x1000

x1000

x1000

x1000

x1000

Deep

Learning

Model

Image

Classifier

Page 5: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

5

Data Types for Deep Learning

Signal ImageText

Page 6: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

6

Deep Learning is Versatile

Iris Recognition – 99.4% accuracy2

Rain Detection and Removal1Detection of cars and road in autonomous driving systems

1. Deep Joint Rain Detection and Removal from a Single Image" Wenhan Yang,

Robby T. Tan, Jiashi Feng, Jiaying Liu, Zongming Guo, and Shuicheng Yan

2. Source: An experimental study of deep convolutional features for iris recognition

Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE

Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of

deep convolutional features for iris recognition

Page 7: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

7

How is deep learning performing so well?

Page 8: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

8

Deep Learning Uses a Neural Network Architecture

Input

Layer Hidden Layers (n)

Output

Layer

Page 9: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

9

Thinking about Layers

▪ Layers are like blocks

– Stack them on top of each other

– Replace one block with a

different one

▪ Each hidden layer processes

the information from the

previous layer

Page 10: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

10

Thinking about Layers

▪ Layers are like blocks

– Stack them on top of each other

– Replace one block with a

different one

▪ Each hidden layer processes

the information from the

previous layer

➢ Layers can be ordered in

different ways

Page 11: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

11

Deep Learning in 6 Lines of MATLAB Code

Page 12: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

12

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB Integrates with Open Source

Page 13: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

13

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB integrates with Open Source

Page 14: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

14

“I love to label and

preprocess my data”

True False

Page 15: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

15

Caterpillar Case Study

▪ World’s leading manufacturer of

construction and mining

equipment.

▪ Similarity between these

projects?

– Autonomous haul trucks

– Pedestrian detection

– Equipment classification

– Terrain mapping

Page 16: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

16

Computer Must Learn from Lots of Data

▪ ALL data must first be labeled to create these autonomous systems.

“We were spending way too much time ground-truthing [the data]”

--Larry Mianzo, Caterpillar

Page 17: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

17

How Did Caterpillar Do with Our Tools?

▪ Semi-automated labeling process

▪ Used MATLAB for entire development workflow.

– “Because everything is in MATLAB, development time is short”

Page 18: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

18

Speed up labeling with Image Labeler App

Page 19: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

19

Page 20: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

20

Page 21: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

21

Page 22: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

22

MATLAB is Productive

▪ Image Labeler App semi-automates labeling workflow

▪ Bootstrapping

– Improve automatic labeling by updating algorithm as you label

more images correctly.

Page 23: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

23

MATLAB is Fast

Performance

Training Deployment

Page 24: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

24

What is Training?Feed labeled data into neural network to create working model

Convolution

Neural

Network

Image

Classifier

Model

x1000

x1000

x1000

x1000

x1000

Page 25: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

25

Speech Recognition Example

Audio signal → Spectrogram → Image Classification algorithm

Time Time

Am

plit

ude

Fre

quency

Page 26: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

26

Side note: Another Network for Signals - LSTM

▪ LSTM = Long Short Term Memory (Networks)

– Signal, text, time-series data

– Use previous data to predict new information

▪ I live in France. I speak ___________.

c0 C1 Ct

Page 27: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

27

1. Create Datastore

▪ Datastore creates

reference for data

▪ Do not have to load in

all objects into memory

Page 28: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

28

2. Compute Speech Spectrograms

Am

plit

ude

Fre

quency

Time

Page 29: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

29

3. Split datastores

Training Validation Test

70% 15% 15%

• Trains the model

• Computer “learns”

from this data

• Checks accuracy

of model during

training

• Tests model accuracy

• Not used until validation

accuracy is good

Page 30: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

30

4. Define Architecture and Parameters

Neural Network Architecture

Model Parameters

Page 31: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

31

5. Train Network

Page 32: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

32

Deep Learning on CPU, GPU, Multi-GPU and Clusters

Single CPU

Single CPUSingle GPU

HOW TO TARGET?

Single CPU, Multiple GPUs

On-prem server with GPUs

Cloud GPUs(AWS)

Page 33: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

33

MATLAB is Fast for Deployment

▪ Target a GPU for optimal

performance

▪ NVIDIA GPUs use CUDA

code

▪ We only have MATLAB code.

Can we translate this?

Page 34: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

34

GPU Coder

▪ Automatically generates CUDA Code from MATLAB Code

– can be used on NVIDIA GPUs

Page 35: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

35

Prediction Performance: Fast with GPU Coder

Why is GPU Coder so fast?

– Analyzes and optimizes

network architecture

– Invested 15 years in code

generation

AlexNet ResNet-50 VGG-16

TensorFlow

MATLAB

MXNet

GPU Coder

Images/Sec

Page 36: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

36

Why MATLAB?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB Integrates with Open Source

Page 37: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

37

Used MATLAB and Open Source Together

1. Deep Joint Rain Detection and Removal from a Single

Image" Wenhan Yang, Robby T. Tan, Jiashi Feng,

Jiaying Liu, Zongming Guo, and Shuicheng Yan

▪ Used Caffe and MATLAB

together

▪ Use our tools where it

makes your workflow

easier!

Page 38: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

38

MATLAB Integrates with Open Source Frameworks

▪ Access to many pretrained models through add-ons

▪ Users wanted to import latest models

▪ Import models directly from Tensorflow or Caffe

– Allows for improved collaboration

Page 39: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

39

Keras-Tensorflow Importer

Page 40: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

40

MATLAB Integrates with Open Source

Frameworks

▪ MATLAB supports entire deep learning workflow

– Use when it is convenient for your workflow

▪ Access to latest models

▪ Improved collaboration with other users

Page 41: Demystifying Deep Learning...4 Deep Learning Model learns to perform classification tasks directly from data. x1000 x1000 x1000 x1000 x1000 Deep Learning Model Image Classifier 6 Deep

41

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast (Performance)

▪ MATLAB Integrates with Open Source

(Frameworks)