© 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016...

42
1 © 2015 The MathWorks, Inc.

Transcript of © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016...

Page 1: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

1© 2015 The MathWorks, Inc.

Page 2: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

2© 2015 The MathWorks, Inc.

개발에서구현까지MATLAB 환경에서의딥러닝

김종남Application Engineer

Page 3: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

3

Page 4: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

4

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB Integrates with Open Source

Page 5: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

6

What is Deep Learning?

Page 6: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

7

Deep Learning

Model learns to perform classification tasks directly from data.

x1000

x1000

x1000

x1000

x1000

Deep

Learning

Model

Image

Classifier

Page 7: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

8

Data Types for Deep Learning

Signal ImageText

Page 8: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

9

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 9: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

10

How is deep learning performing so well?

Page 10: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

11

Deep Learning Uses a Neural Network Architecture

Input

Layer Hidden Layers (n)

Output

Layer

Page 11: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

12

Thinking about Layers

▪ Layers are like blocks

– Stack on top of each other

– Replace one block with a

different one

▪ Each hidden layer processes

the information from the

previous layer

Page 12: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

13

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 13: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

14

Deep Learning in 6 Lines of MATLAB Code

Page 14: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

15

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB integrates with Open Source

Page 15: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

16

“I love to label and

preprocess my data”

~ Said no engineer, ever.

Page 16: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

17

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 17: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

18

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 18: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

19

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 19: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

20

How Does MATLAB Come into Play?

Page 20: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

21

Page 21: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

22

Page 22: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

23

Page 23: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

24

MATLAB is Productive

▪ Image Labeler App semi-automates labeling workflow

▪ Bootstrapping

– Improve automatic labeling by updating algorithm as you label

more images correctly.

▪ Easy to load metadata even when labeling manually

Page 24: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

25

MATLAB is Fast

Performance

Training Deployment

Page 25: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

26

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 26: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

27

Speech Recognition Example

Audio signal → Spectrogram → Image Classification algorithm

Time Time

Am

plit

ude

Fre

quency

Page 27: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

28

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 28: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

29

1. Create Datastore

▪ Datastore creates

reference for data

▪ Do not have to load in

all objects into memory

Page 29: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

30

2. Compute Speech Spectrograms

Am

plit

ude

Fre

quency

Time

Page 30: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

31

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 31: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

32

4. Define Architecture and Parameters

Neural Network Architecture

Model Parameters

Page 32: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

33

5. Train Network

Page 33: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

34

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 34: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

36

Training is an Iterative Process

Parameters adjusted according to performance

Page 35: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

37

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 36: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

38

GPU Coder

▪ Automatically generates CUDA Code from MATLAB Code

– can be used on NVIDIA GPUs

▪ CUDA extends C/C++ code with constructs for parallel computing

Page 37: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

39

GPU Coder Performance

Page 38: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

41

Why MATLAB?

▪ MATLAB is Productive

▪ MATLAB is Fast

▪ MATLAB Integrates with Open Source

Page 39: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

43

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 40: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

44

Keras-Tensorflow Importer

Page 41: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

45

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 42: © 2015 The MathWorks, Inc. · Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE Shervin Minaee ; Amirali Abdolrashidiy ; Yao Wang; An experimental study of deep

46

Why MATLAB for Deep Learning?

▪ MATLAB is Productive

▪ MATLAB is Fast (Performance)

▪ MATLAB Integrates with Open Source

(Frameworks)