deep learning in matlab - mathworks.com · neural network toolbox parallel computing toolbox image...

36
1 © 2018 The MathWorks, Inc. Deep Learning in MATLAB: A Brief Overview Brett Shoelson, PhD Principal Application Engineer

Upload: tranxuyen

Post on 29-Aug-2019

295 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

1© 2018 The MathWorks, Inc.

Deep Learning in MATLAB:A Brief Overview

Brett Shoelson, PhD Principal Application Engineer

Page 2: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

2

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

Page 3: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

3

Example 1: Object recognition using deep learning

Page 4: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

4

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 5: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

5

What is Machine Learning?What is Deep Learning?

Page 6: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

6

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 7: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

7

Deep Learning

Machine Learning vs Deep Learning

We need only specify

the architecture of the

model…

Page 8: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

8

▪ 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 9: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

9

Why is Deep Learning So Popular Now?

Source: ILSVRC Top-5 Error on ImageNet

Human

Accuracy

AlexNet

Page 10: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

10

Two Approaches for Deep Learning

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

1. Train a Deep Neural Network from Scratch

Page 11: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

11

Pains In Deep Learning

Expertise Time to Train Data

Page 12: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

12

Example: Vehicle recognition using deep transfer learning

5 Category

Classifier

Cars

Trucks

SUVs

Big Trucks

Vans

Page 13: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

13

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 14: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

14

Detection and localization using deep learning

Regions with Convolutional Neural Network Features (R-CNN)

Page 15: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

15

What is semantic segmentation?

Page 16: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

16

Original Image

ROI detection

Pixel classification

Localization using deep learning

Page 17: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

17

Semantic Segmentation Network

Boat

Airplane

Other classes

Page 18: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

18

Semantic Segmentation Network

Page 19: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

19

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 20: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

20

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 21: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

21

“I love to label and

preprocess my data”

~ Said no engineer, ever.

Page 22: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

22

Data

Ground truth Labeling

“How do I label

my data?”

New App for

Ground Truth

Labeling

Label pixels

and regions for

semantic

segmentation

Page 23: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

23

Attributes and Sublabels NEW in

Page 24: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

24

Types of Datasets

Numeric

Data

Time Series/

Text Data

Image

Data

ML or LSTMLSTM or CNN

CNN

Page 25: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

25

Analyzing signal data using deep learning

Signal Classification using LSTMs Speech Recognition using CNNs

Page 26: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

26

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 27: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

27

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 28: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

28

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 29: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

29

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 30: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

30

Deploying to CPUs

GPU

Coder

Deep Learning

Networks

NVIDIA

TensorRT &

cuDNN

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Page 31: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

31

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 32: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

32

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 33: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

33

Thank you!

Page 34: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

34

Deep learning in

automated driving…

Page 35: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

35

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 36: Deep Learning in MATLAB - mathworks.com · Neural Network Toolbox Parallel Computing Toolbox Image Processing Toolbox Computer Vision System Toolbox Statistics and Machine Learning

36

Convolutional Neural Networks (CNN)

ObjectsShapes

Edges