1
© 2019 The MathWorks, Inc.
Machine Learning
and Deep Learning with MATLAB
Sergio E. Obando Quintero, Ph.D.
Application Engineer
Source: https://xkcd.com/1838/
2
Machine learning in action
CamVid Dataset
1. 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
3
Machine Learning is Everywhere
Automobile Industrial Automation CES & Aero Defense Energy & Finance
Tire Wear
Detect
Oversteer
Engine Health
(Pred Maintenance)
Forecasting &
Risk Analysis
Overlay metrology
improvement
Building energy
use optimization
Portfolio
Allocation
Telecom customer
churn prediction
4
Artificial Intelligence
Machine Learning
AI, Machine Learning and Deep Learning
Deep Learning
Timeline
1950s Today
1980s
Application
Breadth
Automated Driving
Speech Recognition
Robotics
Object Recognition
Bioinformatics
Recommender Systems
Spam Detection
Fraud Detection
Weather Forecasting
Algorithmic Trading
Sentiment Analysis
Medical Diagnosis
Health Monitoring
Computer Board Games
Machine Translation
Knowledge Representation
Perception
Reasoning
Interactive Programs
Expert Systems
5
What is Machine Learning?
learn complex non-
linear relationships
Solution is too complex for hand written rules or equations
update as more data
becomes available
Solution needs to adapt with changing data
learn efficiently from
very large data sets
Solution needs to scale
Speech Recognition Object Recognition Engine Health Monitoring
Weather Forecasting Energy Load Forecasting Stock Market Prediction
IoT Analytics Taxi Availability Airline Flight Delays
Ability to learn from data without being explicitly programmed
6
Real-life saving pattern-detection application!
Read more...
From
Traditional Monitoring
▪ Outdated technology
▪ Not suitable for children
▪ Considerable patient effort
To
Respiratory Digital Health
▪ Sensors, apps, etc. to monitor and
control symptoms
▪ Convenient effortless
▪ Objective symptom measurement
7
Goals Part I
▪ Overview of machine learning
▪ Machine learning models & techniques available in MATLAB
▪ Using MATLAB to streamline your machine learning workflow
8
Machine Learning
Machine learning uses data and produces a program to perform a task
Traditional Approach Machine Learning Approach
𝑚𝑜𝑑𝑒𝑙 = <
𝑴𝒂𝒄𝒉𝒊𝒏𝒆
𝑳𝒆𝒂𝒓𝒏𝒊𝒏𝒈
𝑨𝒍𝒈𝒐𝒓𝒊𝒕𝒉𝒎
>(𝑠𝑒𝑛𝑠𝑜𝑟_𝑑𝑎𝑡𝑎, 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦)
Computer
Program
Machine
Learning
𝑚𝑜𝑑𝑒𝑙: Inputs → Outputs
Hand Written Program Formula or Equation
If X_acc > 0.5
then “SITTING”
If Y_acc < 4 and Z_acc > 5
then “STANDING”
…
𝑌𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦
= 𝛽1𝑋𝑎𝑐𝑐 + 𝛽2𝑌𝑎𝑐𝑐
+ 𝛽3𝑍𝑎𝑐𝑐 +
…
Task: Human Activity Detection
9
Steps Challenge
Access and Explore data
Data diversity
Numeric, Images, Signals, Text – not always tabular
Preprocess Data
Lack of domain tools
Filtering and feature extraction
Feature selection and transformation
Develop Predictive Models
Time consuming
Train and compare several models to find the “best”
Select optimal parameters and avoid overfitting
Integrate Analytics with Systems
Platform diversity
Translate analytics to production
Deploy on different target platforms
Iterate
Challenges in Machine Learning
10
Different Types of Machine Learning
Machine
Learning
Supervised
Learning
Classification
Regression
Unsupervised
Learning
Clustering
Group and interpret
data based only
on input data
Develop predictive
model based on both
input and output data
Type of Learning Categories of Algorithms
• Discover a good internal representation
• Learn a low dimensional representation
• Output is a real number (temperature,
stock prices).
• Output is a choice between classes
• (True, False) (Red, Blue, Green)
11
Different Types of Machine Learning
Machine
Learning
Supervised
Learning
Classification
Regression
Unsupervised
Learning
Clustering
Group and interpret
data based only
on input data
Develop predictive
model based on both
input and output data
Type of Learning Categories of Algorithms
• k-means, k-medoids, Hierarchical, Gaussian
Mixture Models, Nearest Neighbors, Hidden
Markov Models
• Linear Regression, Generalized Linear Regression,
Nonlinear Regression, Mixed-Effects, Stepwise,
Gaussian Process Regression
• Decision Trees, Nearest Neighbor, Support
Vector Machines, Ensemble Methods,
Discriminant Analysis
12
Machine Learning Workflow
Integrate Analytics with
Systems
Desktop Apps
Enterprise Scale
Systems
Embedded Devices
and Hardware
Files
Databases
Sensors
Access and Explore
Data
Develop Predictive
Models
Model Creation e.g.
Machine Learning
Model
Validation
Parameter
Optimization
Preprocess Data
Working with
Messy Data
Data Reduction/
Transformation
Feature
Extraction
13
MODEL
PREDICTION
Machine Learning Workflow
Train: Iterate till you find the best model
Predict: Integrate trained models into applications
MODEL
SUPERVISED
LEARNING
CLASSIFICATION
REGRESSION
PREPROCESS
DATA
SUMMARY
STATISTICS
PCA
FILTERS
CLUSTER
ANALYSIS
LOAD
DATA
PREPROCESS
DATA
SUMMARY
STATISTICS
PCA
FILTERS
CLUSTER
ANALYSIS
NEW
DATA
14
Classification: Human Activity Recognition
Objective: Train a classifier to classify
human activity from sensor data
Data:
Approach:
– Extract features from raw sensor signals
– Train and compare classifiers
– Test results on new sensor data
Predictors 3-axial Accelerometer and
Gyroscope data
Response Activity:
15
PREDICTION
MODEL
Machine Learning Workflow for Classification Example
Train: Iterate till you find the best model
Predict: Integrate trained models into applications
MODEL
SUPERVISED
LEARNING
CLASSIFICATION
REGRESSION
PREPROCESS
DATA
SUMMARY
STATISTICS
PCA
FILTERS
CLUSTER
ANALYSIS
LOAD
DATA
PREPROCESS
DATA
SUMMARY
STATISTICS
PCA
FILTERS
CLUSTER
ANALYSIS
TEST
DATA
1. Mean
2. Standard
deviation
3. PCA
Classification
Learner
1. Mean
2. Standard
deviation
3. PCA
17
Training: Machine Learning with MATLAB
After this course you will be able to:
▪ Discover natural patterns in data
▪ Create predictive models
▪ Validate the predictions of a model
▪ Simplify and improve models
18
Challenge Solution
Data diversity
Extensive data support
Work with signal, images, financial, textual, and others formats
Lack of domain tools
High-quality libraries
Industry-standard algorithms for Finance, Statistics, Signal,
Image processing & more
Time consuming
Interactive, app-driven workflows
Focus on machine learning, not programing
Select best model and easily fine-tune model parameter
Platform diversity
Run analytics anywhere
Code generation for embedded targets
Deploy to broad range of enterprise system architectures
Flexible architecture for customized workflows
Complete machine learning platform
MATLAB Strengths for Machine Learning
19
Key Takeaways
Use apps in your workflow to
quickly compare and select
candidate algorithms
Use programmatic
workflows for fine-tuning
model parameters to
achieve robust performance
Use feature selection to get rid
of unnecessary features and
prevent overfitting
Use automatic code generation
to rapidly deploy your analytics
to embedded targets
20
Integrate Analytics with Systems
MATLAB
Runtime
C, C ++ HDL PLC
Embedded Hardware
CUDA
MATLAB Analytics
run anywhere
C/C++ ++
Excel
Add-in Java
Hadoop/
Spark
.NET
MATLAB
Production
Server
Standalone
Application
Enterprise Systems
Python
Web Apps
21
Machine Learning for Edge Analytics and Code Deployment
▪ SVM Class.
▪ Linear Class.
▪ Linear Regr.
▪ Generalized Linear Regr.
▪ Decision trees
▪ Ensembles for Class.
▪ Ensembles for Regr.
▪ SVM Regr.
▪ KNN Class.
▪ Gaussian Process Regr.
▪ Discriminant Analysis
Deploy trained models as standalone C/C++ code
23
© 2019 The MathWorks, Inc.
Deep Learning
A Practical Approach in MATLAB
24
What is Deep Learning?
25
Deep learning is a type of machine learning in which a model learns to
perform tasks directly from image, time-series or text data.
Deep learning is usually implemented using a neural network
architecture.
26
Example 1: Object recognition using deep learning
Training
(GPU)
Millions of images from 1000
different categories
Prediction
Real-time object recognition using
a webcam connected to a laptop
27
Example 2: Detection and localization using deep learning
Regions with Convolutional Neural
Network Features (R-CNN)
Semantic Segmentation using SegNet
28
Example 3: Analyzing signal data using deep learning
Signal Classification using LSTMs Speech Recognition using CNNs
29
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
30
Diverse Applications of Deep Learning
Iris Recognition – 99.4% accuracy1
1. 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
2. "A Real-Time Pedestrian Detector using Deep Learning for Human-Aware Navigation" David Ribeiro, Andre Mateus, Jacinto C. Nascimento, and Pedro Miraldo
3. Deep Joint Rain Detection and Removal from a Single Image" Wenhan Yang, Robby T. Tan, Jiashi Feng, Jiaying Liu, Zongming Guo, and Shuicheng Yan
Human Aware Navigation for Robots2
Rain Detection and Removal3
MatConvnet
MatCaffe
MatConvnet
31
Can you tell the difference? Japanese or Blenheim Spaniel?
Blenheim Spaniel Japanese Spaniel
Source: ILSVRC ImageNet dataset
32
Why is Deep Learning So Popular Now?
Source: ILSVRC Top-5 Error on ImageNet
Human
Accuracy
33
Deep Learning Enablers
• Labeled public datasets
• Increased GPU acceleration
• World-class models
AlexNet
PRETRAINED
MODEL
Caffe
I M P O R T E R
ResNet-50
PRETRAINED MODEL
TensorFlow-
Keras
I M P O R T E R
VGG-16
PRETRAINED
MODEL
GoogLeNet
PRETRAINED
MODEL
ResNet-101
PRETRAINED MODEL
Inception-v3
M O D E L S
34
Machine Learning vs Deep Learning
Deep learning performs end-to-end learning by learning features, representations and tasks directly
from images, text and sound
Deep learning algorithms also scale with data – traditional machine learning saturates
Machine Learning
Deep Learning
35
Deep Learning Workflow
Files
Databases
Sensors
ACCESS AND EXPLORE
DATA
DEVELOP PREDICTIVE
MODELS
Hardware-Accelerated
Training
Hyperparameter Tuning
Network Visualization
LABEL AND PREPROCESS
DATA
Data Augmentation/
Transformation
Labeling Automation
Import Reference
Models
INTEGRATE MODELS WITH
SYSTEMS
Desktop Apps
Enterprise Scale Systems
Embedded Devices and
Hardware
36
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
37
Fashion-MNIST Dataset
What?
A collection if items
such as bags, shoes,
etc.
Why?
Benchmark machine
learning algorithms
How many?
60,000 training images
10,000 test images
Best results? 96.3% accuracy
Sources: https://github.com/zalandoresearch/fashion-mnist
38
Convolutional Neural Networks (CNN)
“Deep” in deep learning
refers to number of layers
39
Long Short Term Memory Networks
▪ Recurrent Neural Network that carries a memory cell throughout the
process
▪ Sequence Problems
c0 C1 Ct
40
Types of Datasets
Numeric
Data
Time Series/
Text Data
Image
Data
Machine Learning or
LSTM LSTM or CNN
CNN
41
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
42
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
43
Two Approaches for Deep Learning
2. Fine-tune a pre-trained model (transfer learning)
1. Train a Deep Neural Network from Scratch
44
Transfer Learning Workflow
Early layers learn low-
level features (edges,
blobs, colors)
Last layers
learn task-
specific features
1 million images
1000s classes
Load pretrained network
45
Transfer Learning Workflow
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers learn
features specific
to your data
Replace final layers
46
Transfer Learning Workflow
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
47
Fewer classes
Learn faster
New layers learn
features specific
to your data
Replace final layers
Transfer Learning Workflow
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
48
Transfer Learning Workflow
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
Test images
Trained Network
Predict and assess
network accuracy
Probability
Boat
Plane
Car
Train
Deploy results
49
Transfer Learning Workflow
Probability
Boat
Plane
Car
Train
Deploy results
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
50
Example: Food classifier using deep transfer learning
5 Category
Classifier
Caesar salad
French fries
Burgers
Pizza
Sushi
51
Transfer Learning Workflow
Probability
Boat
Plane
Car
Train
Deploy results
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
52
Why Perform Transfer Learning
▪ Requires less data and training time
▪ Reference models (like AlexNet,
VGG-16, VGG-19, Inception-v3) are
great feature extractors
▪ Leverage best network types from
top researchers
(list of all models)
AlexNet
PRETRAINED
MODEL
Caffe
I M P O R T E R
ResNet-50
PRETRAINED MODEL
TensorFlow-
Keras
I M P O R T E R
VGG-16
PRETRAINED
MODEL
GoogLeNet
PRETRAINED
MODEL
ResNet-101
PRETRAINED MODEL
Inception-v3
M O D E L S
53
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
AlexNet
PRETRAINED
MODEL
Caffe
I M P O R T E R
ResNet-50
PRETRAINED MODEL
TensorFlow-
Keras
I M P O R T E R
VGG-16
PRETRAINED
MODEL
GoogLeNet
PRETRAINED
MODEL
ResNet-101
PRETRAINED MODEL
Inception-v3
M O D E L S
54
Interoperability with Deep Learning Frameworks
▪ Import and export models using
the Open Neural Network Exchange
(ONNX) format
▪ Model importers
– Caffe
– TensorFlow-Keras
▪ Access pretrained models
with a single line of code
Sep ‘17 Mar ‘18
Mar ‘17
Sep ‘16 Sep ‘18
ONNX
PyTorch
MATLAB
MXNet
Caffe2 TensorFlow
Chainer
Core ML
Cognitive
Toolkit
Keras-
Tensorflow
Caffe
55
A short recap…
56
What we covered in this section…
▪ Transfer learning
– Easily modify existing networks with one-line commands
▪ Access large datasets
– Using the imageDatastore
▪ Visualize and Analyze Networks
– Using the Network Analyzer
▪ Make training faster
– Freezing the layers
▪ Improve training results
– Data augmentation with augmentedImageDataStore
– Automatic parameter selection with Bayesian hyperparameter tuning
58
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
59
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
60
What is semantic segmentation?
61
Original Image
ROI detection
Pixel classification
62
Semantic Segmentation
CamVid Dataset
1. 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
63
Semantic Segmentation Network
Boat
Airplane
Other classes
64
Semantic Segmentation Network
65
Useful Tools for Semantic Segmentation
▪ Automatically create network structures
– Using segnetLayers and fcnLayers
▪ Handle pixel labels
– Using the pixelLabelImageDatastore and
pixelLabelDatastore
▪ Evaluate network performance
– Using evaluateSemanticSegmentation
▪ Examples and tutorials to learn concepts
66
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
67
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
68
New Product: Text Analytics Toolbox
▪ Text extraction from PDF and Microsoft Word files
▪ Text preprocessing and normalization
▪ TF-IDF and word frequency statistics
▪ Machine learning algorithms, including Latent Dirichlet
Allocation (LDA) and Latent Semantic Analysis (LSA)
▪ Word-embedding training, and pretrained model
import with word2vec, FastText, and GloVe
▪ Word cloud and text scatter plots
Analyze and model text data
70
Time Series Classification (Human Activity Recognition)
Long short-term memory networks
▪ Dataset is accelerometer and gyroscope
signals captured with a smartphone
▪ Data is a collection of time series with 9
channels
Deep
Learning
sequence to one
71
LSTM sequences
Sequence 1 Sequence 2 Sequence (n-1)
1
2
3
4
5
6
7
8
9
2.5 sec 2.5 sec 2.5 sec
……………………………...........
……………………………...........
Standing Walking Sitting
Time
72
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
73
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
74
“I love to label and
preprocess my data”
~ Said no engineer, ever.
75
Data
Apps for Labeling
“How do I label
my data?”
New App for
Ground Truth
Labeling
Label pixels
and regions for
semantic
segmentation
76
Attributes and Sublabels NEW in
77
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
78
Why deep learning?
Fashion MNIST: The “Hello, World!” of deep learning
Transfer learning with CNNs
(optional) Semantic segmentation
(optional) Deep learning with time series data
Ground Truth Labeling for datasets
Everything else in deep learning…
Agenda
79
Deploying Deep Learning Models for Inference
GPU
Coder
Deep Learning
Networks
NVIDIA
TensorRT &
cuDNN
Libraries
ARM
Compute
Library
Intel
MKL-DNN
Library
80
Semantic Segmentation
Running in MATLAB Generated Code from GPU Coder
81
Desktop CPU
Raspberry Pi board
Deploying to CPUs
GPU
Coder
Deep Learning
Networks
NVIDIA
TensorRT &
cuDNN
Libraries
82
Training Performance and Scalability
84
Deep Learning on CPU, GPU, Multi-GPU and Clusters
Single
CPU
Single CPU
Single GPU
HOW TO TARGET?
Single CPU, Multiple GPUs
On-prem server with
GPUs
Cloud GPUs
(AWS)
85
Inference Performance and Deployment
86
Using GPU Coder for Deep Learning
Access Data Preprocess Select Network Train
Image
Acquisition
Tbx
Image
Processing Tbx
Computer
Vision System
Tbx
Neural
Network Tbx
Parallel
Computing Tbx
GPU
Coder
Deploy
87
Using CUDA v9
and cuDNN v7
The inference is for single image performance.
89
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
90
Other Features
91
Designing and Building Deep Learning Models
▪ Edit and build deep networks
(Deep Network Designer app)
▪ Visualize, analyze, and find problems in network
architectures before training​​ (Network Analyzer)
▪ Automate ground-truth labeling using apps
– Image Labeler app
– Video Labeler app
– Audio Labeler app
▪ Monitor training progress with plots for accuracy,
loss, validation metrics, and more
▪ Visualize and debug deep learning models
+
Deep Learning Toolbox
Computer Vision System Toolbox
Audio System Toolbox
92
Define new deep neural network layers
93
Object Detection Frameworks
▪ Single line of code to train a detector
▪ Includes:
– R-CNN
– Fast R-CNN
– Faster R-CNN
94
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
95
Reinforcement Learning
96
What is Reinforcement Learning?
▪ What is Reinforcement Learning?
– Type of machine learning that trains an
‘agent’ through repeated interactions with an
environment
▪ How does it work?
– Through a trial & error process that
maximizes success
97
Reinforcement Learning Applications
▪ Why should you care about Reinforcement Learning?
– It enables the use of deep learning for controls and decision-making applications
Game Play
Controls
Robotics
Autonomous driving
102
Reinforcement Learning Toolbox
New in R2019a
▪ Built-in and custom algorithms for reinforcement
learning
▪ Environment modeling in MATLAB and Simulink
▪ Deep Learning Toolbox support for designing policies
▪ Training acceleration through GPUs and cloud
resources
▪ Deployment to embedded devices and production
systems
▪ Reference examples for getting started
105
Resources
106
Learn More: Machine Learning
Documentation: mathworks.com/machine-learning
107
Learn More: Big Data
▪ MATLAB Documentation
– Strategies for Efficient Use of Memory
– Resolving "Out of Memory" Errors
▪ Big Data with MATLAB
– www.mathworks.com/discovery/big-data-matlab.html
▪ Tall Arrays in Action
– https://www.mathworks.com/videos/matlab-tall-arrays-in-action-122883.html
108
Get Training
Accelerate your learning curve:
- Customized curriculum
- Learn best practices
- Practice on real-world examples
Options to fit your needs:
- Self-paced (online)
- Instructor led (online and in-person)
- Customized curriculum (on-site)
109
MATLAB
Answers
Blogs
Cody
File
Exchange
and
more…
Answers Blogs
ThingSpeak
Every month, over 2 million MATLAB & Simulink users visit MATLAB Central to get questions answered,
download code and improve programming skills.
MATLAB Central Community
MATLAB Answers: Q&A forum; most questions get
answered in only 60 minutes
File Exchange: Download code from a huge repository of
free code including tens of thousands of open source
community files
Cody: Sharpen programming skills while having fun
Blogs: Get the inside view from Engineers who build
and support MATLAB & Simulink
ThingSpeak: Explore IoT Data
And more for you to explore…
Learn Connect
Contribute
110
Resources
▪ Machine Learning Intro Tech talks
▪ Machine Learning with MATLAB:
– Overview
– Cheat sheet
– Introductory eBook
– Mastering Machine Learning eBook
– Try the Classification Learner App in a browser
▪ Deep learning onramp course
111
MathWorks can help you do Deep Learning
▪ Guided evaluations with a
MathWorks deep learning
engineer
▪ Proof-of-concept projects
▪ Deep learning hands-on
workshop
▪ Seminars and technical deep
dives
▪ Deep learning onramp course
▪ Consulting services
▪ Training courses
▪ Technical support
▪ Advanced customer support
▪ Installation, enterprise, and cloud
deployment
▪ MATLAB for Deep Learning
Free resources More options
112
Thank you!
113
© 2019 The MathWorks, Inc.

Machine_Learning_with_MATLAB_Seminar_Latest.pdf

  • 1.
    1 © 2019 TheMathWorks, Inc. Machine Learning and Deep Learning with MATLAB Sergio E. Obando Quintero, Ph.D. Application Engineer Source: https://xkcd.com/1838/
  • 2.
    2 Machine learning inaction CamVid Dataset 1. 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
  • 3.
    3 Machine Learning isEverywhere Automobile Industrial Automation CES & Aero Defense Energy & Finance Tire Wear Detect Oversteer Engine Health (Pred Maintenance) Forecasting & Risk Analysis Overlay metrology improvement Building energy use optimization Portfolio Allocation Telecom customer churn prediction
  • 4.
    4 Artificial Intelligence Machine Learning AI,Machine Learning and Deep Learning Deep Learning Timeline 1950s Today 1980s Application Breadth Automated Driving Speech Recognition Robotics Object Recognition Bioinformatics Recommender Systems Spam Detection Fraud Detection Weather Forecasting Algorithmic Trading Sentiment Analysis Medical Diagnosis Health Monitoring Computer Board Games Machine Translation Knowledge Representation Perception Reasoning Interactive Programs Expert Systems
  • 5.
    5 What is MachineLearning? learn complex non- linear relationships Solution is too complex for hand written rules or equations update as more data becomes available Solution needs to adapt with changing data learn efficiently from very large data sets Solution needs to scale Speech Recognition Object Recognition Engine Health Monitoring Weather Forecasting Energy Load Forecasting Stock Market Prediction IoT Analytics Taxi Availability Airline Flight Delays Ability to learn from data without being explicitly programmed
  • 6.
    6 Real-life saving pattern-detectionapplication! Read more... From Traditional Monitoring ▪ Outdated technology ▪ Not suitable for children ▪ Considerable patient effort To Respiratory Digital Health ▪ Sensors, apps, etc. to monitor and control symptoms ▪ Convenient effortless ▪ Objective symptom measurement
  • 7.
    7 Goals Part I ▪Overview of machine learning ▪ Machine learning models & techniques available in MATLAB ▪ Using MATLAB to streamline your machine learning workflow
  • 8.
    8 Machine Learning Machine learninguses data and produces a program to perform a task Traditional Approach Machine Learning Approach 𝑚𝑜𝑑𝑒𝑙 = < 𝑴𝒂𝒄𝒉𝒊𝒏𝒆 𝑳𝒆𝒂𝒓𝒏𝒊𝒏𝒈 𝑨𝒍𝒈𝒐𝒓𝒊𝒕𝒉𝒎 >(𝑠𝑒𝑛𝑠𝑜𝑟_𝑑𝑎𝑡𝑎, 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦) Computer Program Machine Learning 𝑚𝑜𝑑𝑒𝑙: Inputs → Outputs Hand Written Program Formula or Equation If X_acc > 0.5 then “SITTING” If Y_acc < 4 and Z_acc > 5 then “STANDING” … 𝑌𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦 = 𝛽1𝑋𝑎𝑐𝑐 + 𝛽2𝑌𝑎𝑐𝑐 + 𝛽3𝑍𝑎𝑐𝑐 + … Task: Human Activity Detection
  • 9.
    9 Steps Challenge Access andExplore data Data diversity Numeric, Images, Signals, Text – not always tabular Preprocess Data Lack of domain tools Filtering and feature extraction Feature selection and transformation Develop Predictive Models Time consuming Train and compare several models to find the “best” Select optimal parameters and avoid overfitting Integrate Analytics with Systems Platform diversity Translate analytics to production Deploy on different target platforms Iterate Challenges in Machine Learning
  • 10.
    10 Different Types ofMachine Learning Machine Learning Supervised Learning Classification Regression Unsupervised Learning Clustering Group and interpret data based only on input data Develop predictive model based on both input and output data Type of Learning Categories of Algorithms • Discover a good internal representation • Learn a low dimensional representation • Output is a real number (temperature, stock prices). • Output is a choice between classes • (True, False) (Red, Blue, Green)
  • 11.
    11 Different Types ofMachine Learning Machine Learning Supervised Learning Classification Regression Unsupervised Learning Clustering Group and interpret data based only on input data Develop predictive model based on both input and output data Type of Learning Categories of Algorithms • k-means, k-medoids, Hierarchical, Gaussian Mixture Models, Nearest Neighbors, Hidden Markov Models • Linear Regression, Generalized Linear Regression, Nonlinear Regression, Mixed-Effects, Stepwise, Gaussian Process Regression • Decision Trees, Nearest Neighbor, Support Vector Machines, Ensemble Methods, Discriminant Analysis
  • 12.
    12 Machine Learning Workflow IntegrateAnalytics with Systems Desktop Apps Enterprise Scale Systems Embedded Devices and Hardware Files Databases Sensors Access and Explore Data Develop Predictive Models Model Creation e.g. Machine Learning Model Validation Parameter Optimization Preprocess Data Working with Messy Data Data Reduction/ Transformation Feature Extraction
  • 13.
    13 MODEL PREDICTION Machine Learning Workflow Train:Iterate till you find the best model Predict: Integrate trained models into applications MODEL SUPERVISED LEARNING CLASSIFICATION REGRESSION PREPROCESS DATA SUMMARY STATISTICS PCA FILTERS CLUSTER ANALYSIS LOAD DATA PREPROCESS DATA SUMMARY STATISTICS PCA FILTERS CLUSTER ANALYSIS NEW DATA
  • 14.
    14 Classification: Human ActivityRecognition Objective: Train a classifier to classify human activity from sensor data Data: Approach: – Extract features from raw sensor signals – Train and compare classifiers – Test results on new sensor data Predictors 3-axial Accelerometer and Gyroscope data Response Activity:
  • 15.
    15 PREDICTION MODEL Machine Learning Workflowfor Classification Example Train: Iterate till you find the best model Predict: Integrate trained models into applications MODEL SUPERVISED LEARNING CLASSIFICATION REGRESSION PREPROCESS DATA SUMMARY STATISTICS PCA FILTERS CLUSTER ANALYSIS LOAD DATA PREPROCESS DATA SUMMARY STATISTICS PCA FILTERS CLUSTER ANALYSIS TEST DATA 1. Mean 2. Standard deviation 3. PCA Classification Learner 1. Mean 2. Standard deviation 3. PCA
  • 16.
    17 Training: Machine Learningwith MATLAB After this course you will be able to: ▪ Discover natural patterns in data ▪ Create predictive models ▪ Validate the predictions of a model ▪ Simplify and improve models
  • 17.
    18 Challenge Solution Data diversity Extensivedata support Work with signal, images, financial, textual, and others formats Lack of domain tools High-quality libraries Industry-standard algorithms for Finance, Statistics, Signal, Image processing & more Time consuming Interactive, app-driven workflows Focus on machine learning, not programing Select best model and easily fine-tune model parameter Platform diversity Run analytics anywhere Code generation for embedded targets Deploy to broad range of enterprise system architectures Flexible architecture for customized workflows Complete machine learning platform MATLAB Strengths for Machine Learning
  • 18.
    19 Key Takeaways Use appsin your workflow to quickly compare and select candidate algorithms Use programmatic workflows for fine-tuning model parameters to achieve robust performance Use feature selection to get rid of unnecessary features and prevent overfitting Use automatic code generation to rapidly deploy your analytics to embedded targets
  • 19.
    20 Integrate Analytics withSystems MATLAB Runtime C, C ++ HDL PLC Embedded Hardware CUDA MATLAB Analytics run anywhere C/C++ ++ Excel Add-in Java Hadoop/ Spark .NET MATLAB Production Server Standalone Application Enterprise Systems Python Web Apps
  • 20.
    21 Machine Learning forEdge Analytics and Code Deployment ▪ SVM Class. ▪ Linear Class. ▪ Linear Regr. ▪ Generalized Linear Regr. ▪ Decision trees ▪ Ensembles for Class. ▪ Ensembles for Regr. ▪ SVM Regr. ▪ KNN Class. ▪ Gaussian Process Regr. ▪ Discriminant Analysis Deploy trained models as standalone C/C++ code
  • 21.
    23 © 2019 TheMathWorks, Inc. Deep Learning A Practical Approach in MATLAB
  • 22.
    24 What is DeepLearning?
  • 23.
    25 Deep learning isa type of machine learning in which a model learns to perform tasks directly from image, time-series or text data. Deep learning is usually implemented using a neural network architecture.
  • 24.
    26 Example 1: Objectrecognition using deep learning Training (GPU) Millions of images from 1000 different categories Prediction Real-time object recognition using a webcam connected to a laptop
  • 25.
    27 Example 2: Detectionand localization using deep learning Regions with Convolutional Neural Network Features (R-CNN) Semantic Segmentation using SegNet
  • 26.
    28 Example 3: Analyzingsignal data using deep learning Signal Classification using LSTMs Speech Recognition using CNNs
  • 27.
    29 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 28.
    30 Diverse Applications ofDeep Learning Iris Recognition – 99.4% accuracy1 1. 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 2. "A Real-Time Pedestrian Detector using Deep Learning for Human-Aware Navigation" David Ribeiro, Andre Mateus, Jacinto C. Nascimento, and Pedro Miraldo 3. Deep Joint Rain Detection and Removal from a Single Image" Wenhan Yang, Robby T. Tan, Jiashi Feng, Jiaying Liu, Zongming Guo, and Shuicheng Yan Human Aware Navigation for Robots2 Rain Detection and Removal3 MatConvnet MatCaffe MatConvnet
  • 29.
    31 Can you tellthe difference? Japanese or Blenheim Spaniel? Blenheim Spaniel Japanese Spaniel Source: ILSVRC ImageNet dataset
  • 30.
    32 Why is DeepLearning So Popular Now? Source: ILSVRC Top-5 Error on ImageNet Human Accuracy
  • 31.
    33 Deep Learning Enablers •Labeled public datasets • Increased GPU acceleration • World-class models AlexNet PRETRAINED MODEL Caffe I M P O R T E R ResNet-50 PRETRAINED MODEL TensorFlow- Keras I M P O R T E R VGG-16 PRETRAINED MODEL GoogLeNet PRETRAINED MODEL ResNet-101 PRETRAINED MODEL Inception-v3 M O D E L S
  • 32.
    34 Machine Learning vsDeep Learning Deep learning performs end-to-end learning by learning features, representations and tasks directly from images, text and sound Deep learning algorithms also scale with data – traditional machine learning saturates Machine Learning Deep Learning
  • 33.
    35 Deep Learning Workflow Files Databases Sensors ACCESSAND EXPLORE DATA DEVELOP PREDICTIVE MODELS Hardware-Accelerated Training Hyperparameter Tuning Network Visualization LABEL AND PREPROCESS DATA Data Augmentation/ Transformation Labeling Automation Import Reference Models INTEGRATE MODELS WITH SYSTEMS Desktop Apps Enterprise Scale Systems Embedded Devices and Hardware
  • 34.
    36 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 35.
    37 Fashion-MNIST Dataset What? A collectionif items such as bags, shoes, etc. Why? Benchmark machine learning algorithms How many? 60,000 training images 10,000 test images Best results? 96.3% accuracy Sources: https://github.com/zalandoresearch/fashion-mnist
  • 36.
    38 Convolutional Neural Networks(CNN) “Deep” in deep learning refers to number of layers
  • 37.
    39 Long Short TermMemory Networks ▪ Recurrent Neural Network that carries a memory cell throughout the process ▪ Sequence Problems c0 C1 Ct
  • 38.
    40 Types of Datasets Numeric Data TimeSeries/ Text Data Image Data Machine Learning or LSTM LSTM or CNN CNN
  • 39.
    41 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 40.
    42 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 41.
    43 Two Approaches forDeep Learning 2. Fine-tune a pre-trained model (transfer learning) 1. Train a Deep Neural Network from Scratch
  • 42.
    44 Transfer Learning Workflow Earlylayers learn low- level features (edges, blobs, colors) Last layers learn task- specific features 1 million images 1000s classes Load pretrained network
  • 43.
    45 Transfer Learning Workflow Earlylayers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers learn features specific to your data Replace final layers
  • 44.
    46 Transfer Learning Workflow Earlylayers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers to learn features specific to your data Replace final layers 100s images 10s classes Training images Training options Train network
  • 45.
    47 Fewer classes Learn faster Newlayers learn features specific to your data Replace final layers Transfer Learning Workflow Early layers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers to learn features specific to your data Replace final layers 100s images 10s classes Training images Training options Train network Test images Trained Network Predict and assess network accuracy
  • 46.
    48 Transfer Learning Workflow Earlylayers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers to learn features specific to your data Replace final layers 100s images 10s classes Training images Training options Train network Test images Trained Network Predict and assess network accuracy Test images Trained Network Predict and assess network accuracy Probability Boat Plane Car Train Deploy results
  • 47.
    49 Transfer Learning Workflow Probability Boat Plane Car Train Deployresults Early layers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers to learn features specific to your data Replace final layers 100s images 10s classes Training images Training options Train network Test images Trained Network Predict and assess network accuracy
  • 48.
    50 Example: Food classifierusing deep transfer learning 5 Category Classifier Caesar salad French fries Burgers Pizza Sushi
  • 49.
    51 Transfer Learning Workflow Probability Boat Plane Car Train Deployresults Early layers that learned low-level features (edges, blobs, colors) Last layers that learned task specific features 1 million images 1000s classes Load pretrained network Fewer classes Learn faster New layers to learn features specific to your data Replace final layers 100s images 10s classes Training images Training options Train network Test images Trained Network Predict and assess network accuracy
  • 50.
    52 Why Perform TransferLearning ▪ Requires less data and training time ▪ Reference models (like AlexNet, VGG-16, VGG-19, Inception-v3) are great feature extractors ▪ Leverage best network types from top researchers (list of all models) AlexNet PRETRAINED MODEL Caffe I M P O R T E R ResNet-50 PRETRAINED MODEL TensorFlow- Keras I M P O R T E R VGG-16 PRETRAINED MODEL GoogLeNet PRETRAINED MODEL ResNet-101 PRETRAINED MODEL Inception-v3 M O D E L S
  • 51.
    53 Import the LatestModels 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 AlexNet PRETRAINED MODEL Caffe I M P O R T E R ResNet-50 PRETRAINED MODEL TensorFlow- Keras I M P O R T E R VGG-16 PRETRAINED MODEL GoogLeNet PRETRAINED MODEL ResNet-101 PRETRAINED MODEL Inception-v3 M O D E L S
  • 52.
    54 Interoperability with DeepLearning Frameworks ▪ Import and export models using the Open Neural Network Exchange (ONNX) format ▪ Model importers – Caffe – TensorFlow-Keras ▪ Access pretrained models with a single line of code Sep ‘17 Mar ‘18 Mar ‘17 Sep ‘16 Sep ‘18 ONNX PyTorch MATLAB MXNet Caffe2 TensorFlow Chainer Core ML Cognitive Toolkit Keras- Tensorflow Caffe
  • 53.
  • 54.
    56 What we coveredin this section… ▪ Transfer learning – Easily modify existing networks with one-line commands ▪ Access large datasets – Using the imageDatastore ▪ Visualize and Analyze Networks – Using the Network Analyzer ▪ Make training faster – Freezing the layers ▪ Improve training results – Data augmentation with augmentedImageDataStore – Automatic parameter selection with Bayesian hyperparameter tuning
  • 55.
    58 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 56.
    59 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 57.
    60 What is semanticsegmentation?
  • 58.
  • 59.
    62 Semantic Segmentation CamVid Dataset 1.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
  • 60.
  • 61.
  • 62.
    65 Useful Tools forSemantic Segmentation ▪ Automatically create network structures – Using segnetLayers and fcnLayers ▪ Handle pixel labels – Using the pixelLabelImageDatastore and pixelLabelDatastore ▪ Evaluate network performance – Using evaluateSemanticSegmentation ▪ Examples and tutorials to learn concepts
  • 63.
    66 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 64.
    67 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 65.
    68 New Product: TextAnalytics Toolbox ▪ Text extraction from PDF and Microsoft Word files ▪ Text preprocessing and normalization ▪ TF-IDF and word frequency statistics ▪ Machine learning algorithms, including Latent Dirichlet Allocation (LDA) and Latent Semantic Analysis (LSA) ▪ Word-embedding training, and pretrained model import with word2vec, FastText, and GloVe ▪ Word cloud and text scatter plots Analyze and model text data
  • 66.
    70 Time Series Classification(Human Activity Recognition) Long short-term memory networks ▪ Dataset is accelerometer and gyroscope signals captured with a smartphone ▪ Data is a collection of time series with 9 channels Deep Learning sequence to one
  • 67.
    71 LSTM sequences Sequence 1Sequence 2 Sequence (n-1) 1 2 3 4 5 6 7 8 9 2.5 sec 2.5 sec 2.5 sec ……………………………........... ……………………………........... Standing Walking Sitting Time
  • 68.
    72 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 69.
    73 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 70.
    74 “I love tolabel and preprocess my data” ~ Said no engineer, ever.
  • 71.
    75 Data Apps for Labeling “Howdo I label my data?” New App for Ground Truth Labeling Label pixels and regions for semantic segmentation
  • 72.
  • 73.
    77 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 74.
    78 Why deep learning? FashionMNIST: The “Hello, World!” of deep learning Transfer learning with CNNs (optional) Semantic segmentation (optional) Deep learning with time series data Ground Truth Labeling for datasets Everything else in deep learning… Agenda
  • 75.
    79 Deploying Deep LearningModels for Inference GPU Coder Deep Learning Networks NVIDIA TensorRT & cuDNN Libraries ARM Compute Library Intel MKL-DNN Library
  • 76.
    80 Semantic Segmentation Running inMATLAB Generated Code from GPU Coder
  • 77.
    81 Desktop CPU Raspberry Piboard Deploying to CPUs GPU Coder Deep Learning Networks NVIDIA TensorRT & cuDNN Libraries
  • 78.
  • 79.
    84 Deep Learning onCPU, GPU, Multi-GPU and Clusters Single CPU Single CPU Single GPU HOW TO TARGET? Single CPU, Multiple GPUs On-prem server with GPUs Cloud GPUs (AWS)
  • 80.
  • 81.
    86 Using GPU Coderfor Deep Learning Access Data Preprocess Select Network Train Image Acquisition Tbx Image Processing Tbx Computer Vision System Tbx Neural Network Tbx Parallel Computing Tbx GPU Coder Deploy
  • 82.
    87 Using CUDA v9 andcuDNN v7 The inference is for single image performance.
  • 83.
    89 Overview of deeplearning 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
  • 84.
  • 85.
    91 Designing and BuildingDeep Learning Models ▪ Edit and build deep networks (Deep Network Designer app) ▪ Visualize, analyze, and find problems in network architectures before training​​ (Network Analyzer) ▪ Automate ground-truth labeling using apps – Image Labeler app – Video Labeler app – Audio Labeler app ▪ Monitor training progress with plots for accuracy, loss, validation metrics, and more ▪ Visualize and debug deep learning models + Deep Learning Toolbox Computer Vision System Toolbox Audio System Toolbox
  • 86.
    92 Define new deepneural network layers
  • 87.
    93 Object Detection Frameworks ▪Single line of code to train a detector ▪ Includes: – R-CNN – Fast R-CNN – Faster R-CNN
  • 88.
    94 Deep learning featuresoverview ▪ 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
  • 89.
  • 90.
    96 What is ReinforcementLearning? ▪ What is Reinforcement Learning? – Type of machine learning that trains an ‘agent’ through repeated interactions with an environment ▪ How does it work? – Through a trial & error process that maximizes success
  • 91.
    97 Reinforcement Learning Applications ▪Why should you care about Reinforcement Learning? – It enables the use of deep learning for controls and decision-making applications Game Play Controls Robotics Autonomous driving
  • 92.
    102 Reinforcement Learning Toolbox Newin R2019a ▪ Built-in and custom algorithms for reinforcement learning ▪ Environment modeling in MATLAB and Simulink ▪ Deep Learning Toolbox support for designing policies ▪ Training acceleration through GPUs and cloud resources ▪ Deployment to embedded devices and production systems ▪ Reference examples for getting started
  • 93.
  • 94.
    106 Learn More: MachineLearning Documentation: mathworks.com/machine-learning
  • 95.
    107 Learn More: BigData ▪ MATLAB Documentation – Strategies for Efficient Use of Memory – Resolving "Out of Memory" Errors ▪ Big Data with MATLAB – www.mathworks.com/discovery/big-data-matlab.html ▪ Tall Arrays in Action – https://www.mathworks.com/videos/matlab-tall-arrays-in-action-122883.html
  • 96.
    108 Get Training Accelerate yourlearning curve: - Customized curriculum - Learn best practices - Practice on real-world examples Options to fit your needs: - Self-paced (online) - Instructor led (online and in-person) - Customized curriculum (on-site)
  • 97.
    109 MATLAB Answers Blogs Cody File Exchange and more… Answers Blogs ThingSpeak Every month,over 2 million MATLAB & Simulink users visit MATLAB Central to get questions answered, download code and improve programming skills. MATLAB Central Community MATLAB Answers: Q&A forum; most questions get answered in only 60 minutes File Exchange: Download code from a huge repository of free code including tens of thousands of open source community files Cody: Sharpen programming skills while having fun Blogs: Get the inside view from Engineers who build and support MATLAB & Simulink ThingSpeak: Explore IoT Data And more for you to explore… Learn Connect Contribute
  • 98.
    110 Resources ▪ Machine LearningIntro Tech talks ▪ Machine Learning with MATLAB: – Overview – Cheat sheet – Introductory eBook – Mastering Machine Learning eBook – Try the Classification Learner App in a browser ▪ Deep learning onramp course
  • 99.
    111 MathWorks can helpyou do Deep Learning ▪ Guided evaluations with a MathWorks deep learning engineer ▪ Proof-of-concept projects ▪ Deep learning hands-on workshop ▪ Seminars and technical deep dives ▪ Deep learning onramp course ▪ Consulting services ▪ Training courses ▪ Technical support ▪ Advanced customer support ▪ Installation, enterprise, and cloud deployment ▪ MATLAB for Deep Learning Free resources More options
  • 100.
  • 101.
    113 © 2019 TheMathWorks, Inc.