deep learning in matlab - uk.mathworks.com€¦ · deep learning is a type of machine learning in...

41
1 © 2015 The MathWorks, Inc. Deep Learning in MATLAB 성 호 현 부장 [email protected]

Upload: others

Post on 18-Oct-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

1© 2015 The MathWorks, Inc.

Deep Learning in

MATLAB

성 호 현 부장[email protected]

Page 2: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

2

Deep Learning beats Go champion!

Page 3: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

3

AI, Machine Learning, and Deep Learning

Any technique

that enables

machines to

mimic human

intelligence

Statistical methods

enable machines to

“learn” tasks from data

without explicitly

programming

Neural networks with many layers that

learn representations and tasks

“directly” from data

Artificial

IntelligenceMachine

LearningDeep Learning

1950s 1980s 2015

FLOPS MillionThousand Quadrillion

Page 4: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

4

What is can Deep Learning do for us?(An example)

Page 5: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

5

Example 1: Object recognition using deep learning

Page 6: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

6

Object recognition using deep learning

Training (GPU)

Millions of images from 1000

different categories

PredictionReal-time object recognition using

a webcam connected to a laptop

Page 7: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

7

What is Machine Learning?What is Deep Learning?

Page 8: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

8

Machine Learning vs Deep Learning

Machine Learning

We specify the nature

of the features we want

to extract… …and the type of model

we want to build.

Page 9: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

9

Deep Learning

Machine Learning vs Deep Learning

We need only specify

the architecture of the

model…

Page 10: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

10

▪ Deep learning is a type of machine learning in which a model learns to perform tasks like classification – directly from images, texts, or signals.

▪ Deep learning performs end-to-end learning, and is usually implemented using a neural network architecture.

▪ Deep learning algorithms also scale with data – traditional machine

learning saturates.

Page 11: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

11

Why is Deep Learning So Popular Now?

Source: ILSVRC Top-5 Error on ImageNet

Human

Accuracy

AlexNet

Page 12: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

12

Two Approaches for Deep Learning

2. Fine-tune a pre-trained model (transfer learning)

1. Train a Deep Neural Network from Scratch

Page 13: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

13

Pains In Deep Learning

Expertise Time to Train Data

Page 14: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

14

Example: Vehicle recognition using deep transfer learning

5 Category

Classifier

Cars

Trucks

SUVs

Big Trucks

Vans

Page 15: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

15

Import the Latest Models for Transfer Learning

Pretrained Models*

▪ AlexNet

▪ VGG-16

▪ VGG-19

▪ GoogLeNet

▪ Inception-v3

▪ ResNet50

▪ ResNet-101

▪ Inception-resnet-v2

▪ SqueezeNet

▪ MobileNet(coming soon)

* single line of code to access model

Import Models from Frameworks

▪ Caffe Model Importer

▪ TensorFlow-Keras Model Importer

▪ Onnx - Importer/ Exporter (Coming Soon)

AlexNetPRETRAINED

MODEL

CaffeI M P O R T E R

ResNet-50PRETRAINED MODEL

TensorFlow-

KerasI M P O R T E R

VGG-16PRETRAINED

MODEL

GoogLeNet PRETRAINED

MODEL

ResNet-101PRETRAINED MODEL

Inception-v3M O D E L S

Page 16: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

16

Detection and localization using deep learning

Regions with Convolutional Neural Network Features (R-CNN)

Page 17: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

17

What is semantic segmentation?

Page 18: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

18

Original Image

ROI detection

Pixel classification

Localization using deep learning

Page 19: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

19

Semantic Segmentation Network

Boat

Airplane

Other classes

Page 20: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

20

Semantic Segmentation Network

Page 21: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

21

Semantic Segmentation Demo

CamVid Dataset1. Segmentation and Recognition Using Structure from Motion Point Clouds, ECCV 2008

2. Semantic Object Classes in Video: A High-Definition Ground Truth Database ,Pattern Recognition Letters

Page 22: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

22

Semantic Segmentation

CamVid Dataset1. Segmentation and Recognition Using Structure from Motion Point Clouds, ECCV 2008

2. Semantic Object Classes in Video: A High-Definition Ground Truth Database ,Pattern Recognition Letters

Page 23: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

23

“I love to label and

preprocess my data”

~ Said no engineer, ever.

Page 24: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

24

Data

Ground truth Labeling

“How do I label

my data?”

New App for

Ground Truth

Labeling

Label pixels

and regions for

semantic

segmentation

Page 25: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

25

Attributes and Sublabels NEW in

Page 26: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

26

Types of Datasets

Numeric

Data

Time Series/

Text Data

Image

Data

ML or LSTMLSTM or CNN

CNN

Page 27: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

27

Analyzing signal data using deep learning

Signal Classification using LSTMs Speech Recognition using CNNs

Page 28: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

28

Deep learning features overview

▪ Classification

▪ Regression

▪ Semantic segmentation

▪ Object detection

▪ Scalability – Multiple GPUs

– Cluster or cloud

▪ Custom network layers

▪ Import models – Caffe

– Keras/TensorFlow

▪ Data augmentation

▪ Hyperparameter tuning – Bayesian optimization

▪ Python MATLAB interface

▪ LSTM networks – Time series, signals, audio

▪ Custom labeling – API for ground-truth labeling

automation

– Superpixels

▪ Data validation – Training and testing

Page 29: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

29

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

Using CUDA v9

and cuDNN v7

Page 30: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

30

Overview of deep learning deployment options

“How do I deploy

my model?”

Deploy / Share

▪ Create Desktop Apps

▪ Run Enterprise Solution

▪ Generate C and C++ Code

GPU Coder

▪ Target GPUs

Introducing:

GPU Coder-

Convert to

NVIDIA CUDA

code

▪ Generate C and C++ Code

Page 31: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

31

GPU Coder Fills a Gap in Our Deep Learning Solution

Access Data Preprocess Select Network Train

Image Acq.Image

Processing

Computer

Vision

Neural

NetworkPCT

GPU

Coder

Deploy

InferenceTraining

Page 32: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

32

Deploying to CPUs

GPU

Coder

Deep Learning

Networks

NVIDIA

TensorRT &

cuDNN

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Page 33: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

33

MATLAB products for deep learning

▪ Neural Network Toolbox

▪ Parallel Computing Toolbox

▪ Image Processing Toolbox

▪ Computer Vision System Toolbox

▪ Statistics and Machine Learning Toolbox

▪ MATLAB Coder

▪ GPU Coder

▪ Automated Driving System Toolbox

Required products Recommended products

Page 34: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

34

Deep learning features overview

▪ Classification

▪ Regression *

▪ Semantic segmentation

▪ Object detection *

▪ Scalability *– Multiple GPUs

– Cluster or cloud

▪ Custom network layers *

▪ Import models *– Caffe

– Keras/TensorFlow

▪ Data augmentation *

▪ Hyperparameter tuning *– Bayesian optimization

▪ Python MATLAB interface *

▪ LSTM networks *– Time series, signals, audio

▪ Custom labeling *– API for ground-truth labeling

automation

– Superpixels

▪ Data validation *– Training and testing

* We can cover in more detail outside this presentation

Page 35: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

35

Thank you!

Deep Learning Onramp – MATLAB

Page 36: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

36

Deep learning in

automated driving…

Page 37: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

37

Deep Learning Onramp

▪ Get started using deep learning

methods to perform image recognition.

▪ Free access for everyone

▪ Interactive exercises and short video

demonstrations

▪ Work on real-life image recognition

problems

▪ Topics include:

– Convolutional neural networks

– Working with pre-trained networks

– Transfer learning

– Evaluating network performance

Page 38: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

38

Convolutional Neural Networks (CNN)

ObjectsShapes

Edges

Page 39: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

39

Deep Reinforcement Learning (E.g. Deep Q Network)

▪ Policy is a sequence of actions to

observations to get maximum reward

▪ Reinforcement Learning finds the optimal

policy maximizing the reward

▪ Reinforcement Learning adapts to

changes in environment by improving the

policy

▪ No need for explicit model (model-free)

AGENT

OBSERVATION

SACTIONS

REWARD

POLICY

Page 40: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

40

Google Deepmind’s Deep Q Learning playing Atari Breakout

Page 41: Deep Learning in MATLAB - uk.mathworks.com€¦ · Deep learning is a type of machine learning in which a model learns to perform tasks like classification –directly from images,

41