Deep Learning
Deep Learning
Discover an internal
representation from
input data only
2
What is Deep Learning?
3
Deep learning is a type of supervised machine learning in which a
model learns to perform classification tasks directly from images, text,
or sound.
4
Why is Deep Learning So Popular Now?
Human
Accuracy
6
Deep Learning success enabled by:
8
Many Network Architectures for Deep Learning
Directed Acyclic
Series Network Recurrent Network
Graph Network
and more
(GAN, DQN,…)
AlexNet ResNet
LSTM
YOLO R-CNN
9
Convolutional Neural Networks
Edges
Shapes
Objects
A lot of data
is required
11
Understanding network behavior using visualizations
Filters
…
Deep Dream
Activations
▪ Custom visualizations
– Example: Class Activation Maps
(See blog post)
12
Visualization Technique – Deep Dream
deepDreamImage(...
net, ‘fc8', channel,
'NumIterations', 50, ...
'PyramidLevels', 4,...
'PyramidScale', 1.25);
Images
Network
Training
Labels
Trained Deep
Neural Network
Large Data Set
16
Visualize Features Learned During Training
AlexNet Example
ACCESS AND EXPLORE LABEL AND PREPROCESS DEVELOP PREDICTIVE INTEGRATE MODELS WITH
DATA DATA MODELS SYSTEMS
19
Deep Learning Challenges
Data
▪ Handling large amounts of data
▪ Labeling thousands of signals, images & videos
▪ Transforming, generating, and augmenting data (for different domains)
Training and Testing Deep Neural Networks
▪ Accessing reference models from research
▪ Understanding network behaviour
▪ Optimizing hyperparameters
▪ Training takes hours-days
Rapid and Optimized Deployment
▪ Desktop, web, cloud, and embedded hardware
20
Working with Signal Data
Signals
Sequence Fully Connected
Labels Layers Layers Trained Model
c0 C1 Ct
22
RNN to LSTM
Cell state
Input gate
Forget gate
Update
Output gate
23
Example: Speaker Gender Recognition Using Deep Learning
LSTM Network for Audio based Speaker Classification
audioDatastore
1. Train
Training Data
− Male
− Female
Time-varying
features:
Mozilla Common
- MFCC
Voice Dataset - Pitch
- ...
2. Predict
Test Data
− Male
− Female
24
Some audio and speech applications following CNN workflows
27
https://www.isca-speech.org/archive/interspeech_2015/papers/i15_1478.pdf
28
Solution2: Speech Command Recognition with Deep Learning(MATLAB)
Integrated Analytic
Preprocessed Models and Algorithms
Raw Data Systems
Data
...
29
43
44
45
46
Data augmentation allows training more advanced networks and
generating more robust models
Original Simulate:
Dataset - lower voice
- varying level of environmental interference
- recording hardware effects
- distortions due to use of different microphones
- different speaker vs microphone positions or room sizes in
enclosed environments
- ... 50
% Cycle continuously and automatically through files in datastore
Serial
mfccFile = zeros(numel(ads.Files),numMfcc)
while hasdata(ads)
[data,info] = read(ads);
% do something with data
end
parfor index=1:N
subads = partition(ads,N,index);
Parallel
while hasdata(subads)
data = read(subads);
% do something with data
end
end
52
53
BREAK
54
Deep Learning Challenges
Data
Not a deep learning expert
✓ Handling large amounts of data
▪ Labeling thousands of signals, images & videos
▪ Transforming, generating, and augmenting data (for different domains)
Training and Testing Deep Neural Networks
✓ Understanding network behavior
▪ Accessing reference models from research
▪ Optimizing hyperparameters
▪ Training takes hours-days
Rapid and Optimized Deployment
▪ Desktop, web, cloud, and embedded hardware
55
BREAK
56
57
Speech 2 text intro
58
59
60
61
62
Audio Labeler
▪ Work on collections of
recordings or record new audio
directly within the app
▪ Navigate dataset and playback
interactively
▪ Define and apply labels to
– Entire files
– Regions within files
63
Apps for Data Labeling
64
Label Images Using Image Labeler App
65
Accelerate Labeling With Automation Algorithms
Learn More
66
Perform Bootstrapping to Label Large Datasets
Images
Videos Train
Network
Labeling Apps Ground Truth
Automation
Algorithm
67
Example – Semantic Segmentation Available Here
▪ CamVid dataset Brostow, Gabriel J., Julien Fauqueur, and Roberto Cipolla. "Semantic object classes in
video: A high-definition ground truth database." Pattern Recognition Letters Vol 30, Issue
2, 2009, pp 88-97. 68
Example: Singing Voice Separation
▪ Source separation
▪ Based on U-Net architecture
69
Synthetically generating labeled data
70
Modulation Classification with Deep Learning
71
Deep Learning Challenges
Data
✓ Handling large amounts of data
✓ Labeling thousands of signals, images & videos
✓ Transforming, generating, and augmenting data (for different domains)
Training and Testing Deep Neural Networks
✓ Understanding network behavior
▪ Accessing reference models from research
▪ Optimizing hyperparameters
▪ Training takes hours-days
Rapid and Optimized Deployment
▪ Desktop, web, cloud, and embedded hardware
72
Transfer Learning
8 lines of MATLAB Code
%% Create a datastore
Load Training Data 1 imds = imageDatastore(‘Data’,...
'IncludeSubfolders',true,'LabelSource','foldernames');
2 num_classes = numel(unique(imds.Labels));
%% Load Referece Network
Load Pre-Trained
Network 3 net = alexnet;
4 layers = net.Layers
%% Replace Final Layers
5 layers(end-2) =
Replace Final Layers fullyConnectedLayer(num_classes,'Name',[‘fc5']);
6 layers(end) = classificationLayer('Name','classOut');
%% Set Training Options & Train Network
7 trainOpts = trainingOptions('sgdm’,...
Train Network on 'MiniBatchSize', 64);
New Data
8 net = trainNetwork(imds, layers, trainOpts);
73
Tune Hyperparameters to Improve Training
Many hyperparameters
▪ depth, layers, solver options,
learning rates, regularization,
…
Techniques
▪ Parameter sweep
▪ Bayesian optimization
74
Keras-Tensorflow Importer
75
Model Exchange and Co-execution
MATLAB Python
76
Model Exchange With Deep Learning Frameworks
TensorFlow-
PyTorch Caffe2 TensorFlow
Keras
MXNet
ONNX MATLAB
Cognitive
Core ML Chainer Caffe
Toolkit
Deployment
PyTorch Caffe2 TensorFlow
Export
Augmentation
MXNet and
ONNX MATLAB Optimization
Import
Cognitive Visualization
Core ML Chainer and
Toolkit
Debugging
▪ importCaffeNetwork
TensorFlow-Keras Model Importer
▪ importKerasLayers
▪ importKerasNetwork
ONNX Converter
▪ importONNXNetwork
▪ exportONNXNetwork
ONNX Converter
79
Model Exchange and Co-execution
MATLAB Python
Model Exchange
Co-execution
80
MATLAB-Python Co-Execution – The ‘How’
Call Python file from Call TensorFlow commands from
MATLAB MATLAB
TF_code.py
81
MATLAB-Python Co-Execution – Method A
def myTFCode():
for x in y:
a.foo()
def foo(x):
TF_code.py return x + 1
82
Deep Learning on CPU, GPU, Multi-GPU and Clusters
H O W T O TA R G E T ?
84
Deep Learning Challenges
Data
✓ Handling large amounts of data
✓ Labeling thousands of signals, images & videos
✓ Transforming, generating, and augmenting data (for different domains)
Training and Testing Deep Neural Networks
✓ Accessing reference models from research
✓ Understanding network behaviour
✓ Optimizing hyperparameters
✓ Training takes hours-days
Rapid and Optimized Deployment
▪ Desktop, web, cloud, and embedded hardware
85
Deploying Deep Learning Application
Code Application
Generation Deployment
86
MATLAB Production Server is an application server that publishes
MATLAB code as APIs that can be called by other applications
Analytics Development
MATLAB MATLAB
Compiler SDK Deploy
3rd party
Scale and secure
dashboard
87
MATLAB support for Cloud
88
89
IAAS to PAAS
90
Automatic Cluster Creation
91
Get Public IP for access
92
Server Machine VM access
• MPS console endpoint: https://xxx.xx.xx.xx
93
Deploying Deep Learning Application
Code Application
Generation Deployment
94
Solution- GPU/MATLAB Coder for Deep Learning Deployment
Target Libraries
TensorRT &
GPU Coder cuDNN
Application Libraries
logic
Intel
MKL-DNN
Library
MATLAB
Coder
ARM
Compute
Library
95
Deep Learning Deployment Workflows
Trained
Pre- Post-
DNN processing processing
cnncodegen
codegen
96
Single Image Inference on Titan Xp using cuDNN
TensorFlow (1.8.0)
MXNet (1.2.1)
PyTorch (0.3.1)
cnncodegen
98
Summary- MATLAB Deep Learning Framework
DEPLOYMENT
Intel
MKL-DNN
Library
99
Summary
✓ Create and validate Deep learning models
✓ Automate ground truth labeling
✓ Access large amount of data from cluster/cloud
✓ Interoperability with Deep learning frameworks
100
Available Here 101
102
103