37
1 © 2015 The MathWorks, Inc. Deep Learning and Reinforcement Learning Workflows in AI Valerie Leung

Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

1© 2015 The MathWorks, Inc.

Deep Learning and

Reinforcement Learning

Workflows in AI

Valerie Leung

Page 2: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

2

Why MATLAB for Artificial Intelligence?

Page 3: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

3

Artificial Intelligence

Development of computer programs to perform tasks that

normally require human intelligence

Page 4: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

4

Speech RecognitionObject Classification

Signal Classification

Predictive Maintenance

Automated Driving Stock Market Prediction

AI Applications

Page 5: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

5

Unsupervised

Learning[No Labeled Data]

Supervised Learning

[Labeled Data]

Clustering Classification Regression

Machine Learning

Machine Learning and Deep Learning

Page 6: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

6

Unsupervised

Learning[No Labeled Data]

Supervised Learning

[Labeled Data]

Clustering Classification Regression

Machine Learning

Deep Learning

Machine learning typically involves

feature extraction

Deep learning typically does not

involve feature extraction

Machine Learning and Deep Learning

Page 7: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

7

Deep Learning Uses a Neural Network Architecture

Input Layer

Hidden Layers (n)

Output

Layer

Page 8: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

8

Deep Learning Datatypes

SignalImage

TextNumeric

Page 9: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

9

Deep Learning Workflow

Ground truth labeling

Train ModelPrepare Data

Model exchange

across frameworks

Model design, hyperparameter

tuning

Data access and

preprocessing

Deploy

Enterprise

deployment

Edge deployment

Multiplatform

code generation

(CPU, GPU)

Hardware-

accelerated training

Page 10: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

10

Why MATLAB for AI Tasks?

Increased productivity with interactive tools

Generate simulation data for complex models and systems

Ease of deployment and scaling to various platforms

Full AI workflows that cannot be easily

replicated by other toolchains

Page 11: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

11

Why MATLAB for AI Tasks?

Increased productivity with interactive tools

Full AI workflows that cannot be easily

replicated by other toolchains

Labeling TrainingModel

Exchange

Page 12: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

12

Labeling for deep learning is repetitive,

tedious, and time-consuming…

but necessary

Page 13: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

13

Partially automate ground truth labeling with Apps

Page 14: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

14

Partially automate ground truth labeling with Apps

App for ground truth

labeling dedicated to

automotive applications

Page 15: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

15

Applications developed using labeled data

Page 16: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

16

User Story – Veoneer (Autoliv)

▪ Automotive:

– Software and hardware for active safety,

autonomous driving, occupant protection,

and brake control

▪ Application:

– Build radar sensor

– Check accuracy using LiDAR-based verification

▪ Used MATLAB to semi-automate labeling and

tracking of 3D LiDAR point clouds

Page 17: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

17

Manual Labeling for 25 events took over 20 minutes.

After automation with MATLAB tools, it took 5 minutes.

Page 18: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

18

Design deep networks interactively

Design network with Deep Network Designer

Check for errors with Network Analyzer

Page 19: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

19

Transfer Learning with Pre-trained Models

AlexNet

ResNet-50

VGG-16

VGG-19

ResNet-18

MobileNetV2

DenseNet-201

Inception-v3

GoogLeNet

SqueezeNet

ResNet-101

Import & Export Models Between Frameworks

TensorFlow-Keras

Importer

Caffe Model

ImporterONNX Model

Converter

Xception

Inception-

ResNet-v2

Page 20: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

20

Model Exchange with MATLAB

PyTorch

Caffe2

MXNet

Core ML

CNTK

TensorFlow-

Keras

Caffe

MATLABONNX

ONNX = Open Neural Network Exchange

(…)

Page 21: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

21

Why MATLAB for AI Tasks?

Increased productivity with interactive tools

Generate simulation data for complex models and systems

Ease of deployment and scaling to various platforms

Full AI workflows that cannot be easily

replicated by other toolchains

Page 22: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

22

Why MATLAB for AI Tasks?

Generate simulation data for complex models and systems

Full AI workflows that cannot be easily

replicated by other toolchains

Reinforcement

Learning

Page 23: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

23

Unsupervised

Learning[No Labeled Data]

Supervised Learning

[Labeled Data]

Clustering Classification Regression

Deep Learning

Machine Learning

Reinforcement

Learning

[Interaction Data]

Decision

MakingControls

Reinforcement Learning vs Machine Learning vs Deep Learning

Reinforcement learning learns

through trial and error, i.e.

through interaction

It’s about learning a behavior or

accomplishing a task

Page 24: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

24

What is Reinforcement Learning?

Reinforcement learning is a type of machine learning that trains an agent through

repeated interactions with an environment through a trial & error process that uses

a reward system to maximize success

Page 25: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

25

A Practical Example of Reinforcement LearningTraining a Self-Driving Car

Page 26: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

26

A Practical Example of Reinforcement LearningTraining a Self-Driving Car

► Vehicle’s computer learns how to drive [agent]

► using sensor readings from LIDAR, cameras [observation]

► that represent road conditions, vehicle position [environment]

► by generating steering, braking, throttle commands [action]

► to avoid collisions and lane deviation [reward].

AGENT

ENVIRONMENT

ACTION

REWARD

OBSERVATION

The goal of reinforcement learning is for the agent to find

an optimal algorithm for performing a task

Page 27: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

27

Deep Networks are commonly found in the agent, because

they can model complex problems.

AGENT

• Turn left

• Turn right

• Brake

• Accelerate

Page 28: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

28

Reinforcement Learning Workflow

Train ModelGenerate Data Deployment

Developing reward

system to optimize

performance

Training agent to

perform task

Scenario Design

Simulation-based

data generation

Enterprise

deployment

Edge deployment

Reinforcement learningMultiplatform code

generation

(CPU, GPU)

Simulink –

generate data for

dynamic systems

(planes, cars,

robots, etc.)

Page 29: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

29

Scaling up deep learning in parallel and in the cloud

Run thousands of simulations in parallel with MATLAB Parallel Server

to save hours of training time.

MATLAB Parallel

Server

MATLAB

+

Parallel Computing

Toolbox

Cloud

GPU

Multicore

CPU

Page 30: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

30

▪ Reinforcement learning is a

dynamic process

▪ MATLAB and Simulink virtual models

allow you to simulate conditions that

are difficult or dangerous to emulate in

the real world

▪ Suitable for:

– Control-based problems, e.g. automated driving (lane keep assist, adaptive cruise control), robotics, etc.

– Decision-making problems, e.g.

financial trading, games, etc.

MATLAB and Simulink for Reinforcement Learning

Page 31: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

31

Why MATLAB for AI Tasks?

Increased productivity with interactive tools

Ease of deployment and scaling to various platforms

Generate simulation data for complex models and systems

Full AI workflows that cannot be easily

replicated by other toolchains

Page 32: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

32

Why MATLAB for AI Tasks?

Full AI workflows that cannot be easily

replicated by other toolchains

Code

GenerationEmbedded

Devices

Enterprise

Systems

Ease of deployment and scaling to various platforms

Page 33: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

33

Deployment and Scaling for AI

Embedded Devices Enterprise Systems

Page 34: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

34

Deploying Deep Learning Models for Inference

Deep Learning

Networks

NVIDIA

TensorRT &

cuDNN

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Page 35: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

35

Benchmark of GPU Coder

Intel® Xeon® CPU 3.6 GHz - NVIDIA libraries: CUDA10 - cuDNN 7 - Frameworks: TensorFlow 1.13.0, MXNet 1.4.0 PyTorch 1.0.0

TensorFlow

MXNet

GPU Coder

PyTorch

Page 36: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

36

Musashi Seimitsu Industry Co.,Ltd.Detect Abnormalities in Automotive Parts

MATLAB use in project:

▪ Preprocessing of captured images

▪ Image annotation for training

▪ Deep learning-based analysis

– Various transfer learning methods

(Combinations of CNN models, Classifiers)

– Estimation of defect area using Class Activation

Map (CAM)

– Abnormality/defect classification

▪ Deployment to NVIDIA Jetson using GPU CoderAutomated visual inspection of 1.3 million

bevel gear per month

Page 37: Template for MATLAB EXPO 2019...Deep Learning Uses a Neural Network Architecture Input Layer Hidden Layers (n) Output Layer 8 Deep Learning Datatypes Image Signal Text Numeric 9 Deep

37

Why MATLAB for AI Tasks?

Increased productivity with interactive tools

Generate simulation data for complex models and systems

Ease of deployment and scaling to various platforms

Full AI workflows that cannot be easily

replicated by other toolchains