Deep Learning: Development to Deployment
Transcript of Deep Learning: Development to Deployment
![Page 1: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/1.jpg)
1© 2019 The MathWorks, Inc.
Deep Learning: Development to Deployment
Spandhana Gonuguntla, PhD
Education Technical Evangelist
Indian Institute of Science
27th Feb 2020
![Page 2: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/2.jpg)
2
Administrivia
▪ If you have laptops running MATLAB 2019b, please ensure you collect the
files necessary for this workshop
▪ Download support package for AlexNet if you haven’t already done so
– >> net = alexnet (shouldn’t throw an error)
▪ Fill up this survey : https://tinyurl.com/w5xcfht
![Page 3: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/3.jpg)
3
![Page 4: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/4.jpg)
4
![Page 5: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/5.jpg)
5
![Page 6: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/6.jpg)
6
Artificial Intelligence
The capability of a machine to imitate
intelligent human behavior
![Page 7: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/7.jpg)
7
Artificial Intelligence
The capability of a machine to match or exceed
intelligent human behavior
![Page 8: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/8.jpg)
8
Artificial Intelligence Today
The capability of a machine to match or exceed
intelligent human behavior
by training a machine to learn the desired behavior
![Page 9: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/9.jpg)
9
There are two ways to get a computer to do what you want
Traditional Programming
COMPUTER
Program
Output
Data
![Page 10: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/10.jpg)
10
There are two ways to get a computer to do what you want
Machine Learning
COMPUTERProgram
Output
Data
![Page 11: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/11.jpg)
11
There are two ways to get a computer to do what you want
Machine Learning
COMPUTERModel
Output
Data
Artificial
Intelligence
Machine
Learning
Deep
Learning
![Page 12: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/12.jpg)
12
What is Deep Learning really?
Image from: xkcd.com
![Page 13: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/13.jpg)
13
Deep Learning is a subset of machine learning that uses neural networks to extract features from data
![Page 14: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/14.jpg)
14
Machine Learning vs Deep Learning
Deep learning performs end-to-end learning by learning features, representations and tasks directly from images,
time-series, and text data
Machine Learning
Deep Learning
We specify the nature of the
features we want to extract… …and the type of model
we want to build.
![Page 15: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/15.jpg)
15
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 16: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/16.jpg)
16
Detection and localization using deep learning
Regions with Convolutional Neural
Network Features (R-CNN)Semantic Segmentation using SegNet
![Page 17: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/17.jpg)
17
Analyzing signal data using deep learning
Signal Classification using LSTMs Speech Recognition using CNNs
![Page 18: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/18.jpg)
18
Why is Deep Learning So Popular Now?
Source: ILSVRC Top-5 Error on ImageNet
Human
Accuracy
![Page 19: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/19.jpg)
19
Deep Learning Enablers
• Labeled public datasets
• Increased GPU acceleration
• World-class modelsAlexNetPRETRAINED
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
ONNX ConverterMODEL CONVERTER
Inception-v3M O D E L S
![Page 20: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/20.jpg)
20
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
![Page 21: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/21.jpg)
21
Introducing Deep Learning Inference in 5 lines
•>> net = alexnet;
•>> I = imread('peacock.jpg')
•>> I1 = imresize(I,[227 227]);
•>> classify(net,I1)
•ans =
• categorical
• peacock
![Page 22: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/22.jpg)
22
Classifies into classes that it has been trained on
>> wordcloud(net.Layers(end).Classes)
imagenet has 1000 categories, 14 million+ images
![Page 23: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/23.jpg)
23
Convolutional Neural Network (CNN)/ Deep Neural Network
(DNN)
Convolution +
ReLU PoolingInput
Convolution +
ReLU Pooling
… …
Flatten Fully
ConnectedSoftmax
dog
…
cat
… …
Feature Learning Classification
goldfish✓
![Page 24: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/24.jpg)
24
What do these layers learn?
Convolution +
ReLU PoolingInput
Convolution +
ReLU Pooling
… …
Flatten Fully
ConnectedSoftmax
dog
…
cat
… …
Feature Learning Classification
goldfish✓
“lower-level” features “higher-level” features
![Page 25: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/25.jpg)
25
Convolution Layers Search for Patterns
These patterns would be common in the number 0
![Page 26: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/26.jpg)
26
▪ Core building block of a CNN
▪ Convolve the filters sliding them across the input, computing the dot product
3
3 3
3
3 3
Convolution Layer – What makes a Deep Neural Network a
Convolutional Neural Network
7
73
3
3 2dot
dot
sum
W1
W2
▪ Intuition: learn filters that activate when they “see” some specific feature
![Page 27: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/27.jpg)
27
Convolution Layers Learn Patterns
alexnet learnt these ‘patterns’ from
imagenet – from 96 filters of size11-by-11 in
‘conv1’ (Krizhevsky et al, 2012)
% In MATLAB:
>> layer = convolution2dLayer(filterSize, numFilters)
See here for more: https://cs231n.github.io/convolutional-networks/
![Page 28: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/28.jpg)
29
Max Pooling sub-samples activations
1 3 5 1
3 7 4 3
0 4 6 5
2 3 4 1
7 5
4 6
2x2 filters
Stride Length = 2
% In MATLAB:
>> layer = maxPooling2dLayer(poolSize)
224x224x64
112x112x128
Also look for minPooling and averagePooling.
![Page 29: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/29.jpg)
30
Rectified Linear Units Layer (ReLU)
Typically converts negative numbers to zero
-1 0 5 4
3 -4 -8 3
1 4 6 -5
-2 -5 4 1
0 0 5 4
3 0 0 3
1 4 6 0
0 0 4 1
% In MATLAB:
>> layer = reluLayer()
![Page 30: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/30.jpg)
31
Classification Problems End with 3 Layers
▪ Fully Connected Layer
– Looks at which high-level features correspond to a specific category
– Calculates scores for each category (highest score wins)
▪ Softmax Layer
– Turns scores into probabilities.
▪ Classification Layer
– Categorizes image into one of the classes that the network is trained on
Note: Regression problems end with a fully connected layer and regression layer
![Page 31: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/31.jpg)
32
Two Approaches for Deep Learning
2. Fine-tune a pre-trained model (transfer learning)
1. Train a Deep Neural Network from Scratch
![Page 32: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/32.jpg)
33
When Do I Need to Train My Own Model ?
▪ Available pre-trained models do not work
– Low accuracy on your data-set
– Different category definitions
– Different task (classification v/s regression)
▪ Pre-trained model not available for your data type
– Most available networks trained on natural images
![Page 33: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/33.jpg)
34
3 Components to Train a Network
DataNetwork
Architecture
Training
Options
How much data?
It depends…but
A LOT
Define Inputs and
layers for deep
learning
Influence training
time and accuracy
• Solver type
• Initial Learn Rate
• Minibatch Size
• Max Epochs
• …
![Page 34: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/34.jpg)
35
MNIST: The “Hello, World!” of computer vision
What?A set of handwritten
digits from 0-9
Why?An easy task for
machine learning
beginners
How many?60,000 training images
10,000 test images
Best results? 99.79% accuracy = 7
Sources: http://yann.lecun.com/exdb/mnist/https://rodrigob.github.io/are_we_there_yet/build/classification_datasets_results
![Page 35: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/35.jpg)
36
![Page 36: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/36.jpg)
37
![Page 37: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/37.jpg)
38
Visualizations for Understanding Network Behavior
▪ generate images that strongly activate a
particular channel of the network layers.
▪ Custom visualizations
– Example: Class Activation Maps
▪ Use activations on layers
Filters…
Activations
Deep Dream
http://cnnlocalization.csail.mit.edu/Zhou_Learning_Deep_Features_CVPR_2016_paper.pdf
![Page 38: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/38.jpg)
39
Visualization Technique – Deep Dream
deepDreamImage(...
net, 'fc5', channel,
'NumIterations', 50, ...
'PyramidLevels', 4,...
'PyramidScale', 1.25);
Synthesizes images that strongly activate
a channel in a particular layer
Example Available Here
![Page 39: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/39.jpg)
40
Visualize Features Learned During Training
AlexNet Example
Sample Training Data Features Learned by Network
![Page 40: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/40.jpg)
41
Visualize Features Learned During Training
AlexNet Example
Sample Training Data Features Learned by Network
![Page 41: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/41.jpg)
42
occlusionSensitivity for visualizing what layers mostly
“look” at▪ Easy-to-understand visualization to help explain why a network makes the decision it does
▪ Most commonly used for image classification e.g. to show which part of the image causes
the ‘pizza’ classification
pizzaImg = imds.read();predLabel = classify(net, pizzaImg); % “pizza” – but why?
map = occlusionSensitivity(net, pizzaImg, ...predLabel);
imshow(pizzaImg); hold on;imagesc(map, ‘Alpha’, 0.5);
![Page 42: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/42.jpg)
43
Two Approaches for Deep Learning
2. Fine-tune a pre-trained model (transfer learning)
✓ Train a Deep Neural Network from Scratch
![Page 43: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/43.jpg)
44
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
![Page 44: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/44.jpg)
45
Example: Food classifier using deep transfer learning
5 Category
Classifier
Hot dog
French fries
Chocolate cake
Pizza
Ice cream
![Page 45: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/45.jpg)
46
Predicted class
Inference application
implemented in a few
lines of code
![Page 46: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/46.jpg)
47
Why Perform Transfer Learning ?
▪ Leverage best network types from top
researchers
▪ Reference models (such as AlexNet,
VGG-16, VGG-19) are great feature
representations
▪ Requires less data and training time
Download from within MATLAB
Pretrained Models in MATLAB
▪ AlexNet
▪ VGG-16
▪ VGG-19
▪ GoogLeNet
▪ Inceptionv3
▪ Resnet50
▪ Resnet101
▪ InceptionResnetv2 net = inceptionresnetv2;
▪ Squeezenet net = squeezenet;
net = alexnet;
net = vgg16;
net = vgg19;
net = googlenet;
net = inceptionv3;
net = resnet50;
net = resnet101;
![Page 47: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/47.jpg)
48
Train a deep neural network from scratchRecommended when:
Training data 1000s to millions of labeled images
Computation Compute intensive (requires GPU)
Training Time Days to Weeks for real problems
Model accuracy High (can over fit to small datasets)
Two Approaches for Deep Learning
Fine-tune a pre-trained model (transfer learning)Recommended when:
Training data 100s to 1000s of labeled images (small)
Computation Moderate computation (GPU optional)
Training Time Seconds to minutes
Model accuracy Good, depends on the pre-trained CNN model
![Page 48: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/48.jpg)
49
Hurdles at every turn…
ACCESS AND EXPLORE
DATA
LABEL AND PREPROCESS
DATA
Files
Databases
Sensors
Working with Messy Data
Labeling Automation
Data Augmentation/
Reduction/ Transformation
• Big Data = Big Memory/Disk.
• Visualizing and Analyzing
Labeled Data?
• Actually labeling large datasets?
• Handling insufficient or poor
quality data?
![Page 49: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/49.jpg)
50
Hurdles at every turn…
DEVELOP PREDICTIVE
MODELS
INTEGRATE MODELS WITH
SYSTEMS
Desktop Apps
Enterprise Scale Systems
Embedded Devices and
Hardware
Hardware-Accelerated
Training
Hyperparameter Tuning
Model Validation
• Training a model is more art than
science! Can I train on my
laptop/desktop? How to scale up to a
GPU?
• How do I tune hyperparameters?
Learning Rate, Weights Initialization?
• Model assessment – how good is good?
• How to deploy a trained model? Desktop,
Cloud, Embedded Devices?
![Page 50: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/50.jpg)
51
Top five issues we hear about while working with Deep Neural
Networks
1. How do I choose a network architecture?
2. How much data do I need?
3. How do I improve accuracy of my network?
4. How do I speed up training?
5. I have a trained model – what do I do next?
![Page 51: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/51.jpg)
52
#1: How do I choose a network architecture?
▪ Image Classification?
– alexnet
– vgg16
– vgg19
– squeezenet
– nasnetmobile
– resnet50
– resnet101
– googlenet
– inceptionv3
– …
– Roll your own architecture!
– more in the near future.
▪ Object Detection?
– RCNN
– Fast RCNN
– Faster RCNN
– YOLO v2
– more in the near future.
▪ Semantic Segmentation?
– Segnet
– U-net
– DeepLabv3plus
– more in the near future.
▪ Instance Segmentation?
▪ More exotic networks?
– Talk to us! We’re
interested to learn more
about your research!
![Page 52: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/52.jpg)
53
#1: Accuracy vs run-time performance of classification
networks
A network is Pareto efficient if there is no other network that is better on the accuracy and prediction time boundary. The set of all
Pareto efficient networks is called the Pareto frontier.
![Page 53: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/53.jpg)
54
#1: Memory/Depth constraints for Classification Networks
![Page 54: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/54.jpg)
55
#1. Where Can I Access Pretrained Models?
▪ Many are built into MATLAB
▪ Others can found on the web and imported into MATLAB
Open Neural
Network Exchange
![Page 55: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/55.jpg)
56
Interoperability with other Deep Learning Frameworks
Import Models from Frameworks
▪ Caffe Model Importer
(including Caffe Model Zoo)
– importCaffeLayers
– importCaffeNetwork
Download from within MATLAB
ONNX - Importer/ Exporter
– importONNXNetwork
– importONNXLayers
– exportONNXNetwork
TensorFlow-Keras Model Importer
– importKerasLayers
– importKerasNetwork
![Page 56: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/56.jpg)
57
Top five issues we hear about while working with Deep Neural
Networks
1. How do I choose a network architecture?
2. How much data do I need?
3. How do I improve accuracy of my network?
4. How do I speed up training?
5. I have a trained model – what do I do next?
![Page 57: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/57.jpg)
58
#2: Need LOTS of data! + Augmentation to generalize
network
Resize
Random-crop
Rotation
Reflection
Scaling
Shearing
Translation
How much data?
It depends (from
scratch, or, Transfer Learning?)
typically A LOT!
![Page 58: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/58.jpg)
59
#2: Not just data – high quality labeled data!
![Page 59: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/59.jpg)
60
#2: Accelerate Labeling With Automation Algorithms
Learn More
![Page 60: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/60.jpg)
61
Ground Truth
Train
Network
Labeling Apps
Images
Videos
Automation
Algorithm
Propose LabelsMore
Ground TruthImprove Network
#2: Perform Bootstrapping to Label Large Datasets
![Page 61: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/61.jpg)
62
Current Time/Effort Investments – Models vs. Data
From "Troubleshooting deep neural networks" (Josh Tobin et al., Jan 2019)
Research
Models andAlgorithms
Datasets
Industry
![Page 62: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/62.jpg)
63
Top five issues we hear about while working with Deep Neural
Networks
1. How do I choose a network architecture?
2. How much data do I need?
3. How do I improve accuracy of my network?
4. How do I speed up training?
5. I have a trained model – what do I do next?
![Page 63: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/63.jpg)
64
#3: Improve accuracy? tune Hyperparameters and experiment!
Many hyperparameters
▪ Network depth/architecture,
solver options, learning rates +
schedules, regularization, …
Techniques
▪ Parameter sweep
▪ Bayesian optimization
Also, use more DATA!link link
![Page 64: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/64.jpg)
65
Top five issues we hear about while working with Deep Neural
Networks
1. How do I choose a network architecture?
2. How much data do I need?
3. How do I improve accuracy of my network?
4. How do I speed up training?
5. I have a trained model – what do I do next?
![Page 65: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/65.jpg)
66
#4: Speed up training using GPUs, Multi-GPUs & Clusters
Single CPU
Single CPUSingle GPU
HOW TO TARGET?
Single CPU, Multiple GPUs
On-prem server with GPUs
Cloud GPUs(AWS)
![Page 66: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/66.jpg)
67
#4: Maybe you fancy cloud GPU instances?
![Page 67: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/67.jpg)
68
Scaling up NVIDIA DGX
docker login nvcr.io
docker pull nvcr.io/partners/matlab:r2019a
rsync -rave ssh /data/genres/ dgx:/tmp/genres
nvidia-docker run –it --rm –p 6080:6080 \
--shm-size=512M \
-v /tmp/genres/:/data \
nvcr.io/partners/matlab:r2019a
![Page 68: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/68.jpg)
69
▪ Desktop access using browser
▪ Or VNC
▪ Or at the docker command
prompt
http://dgx-station:6080
“We’re Gonna Need a Bigger Machine”
![Page 69: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/69.jpg)
70
Getting Started
▪ Start MATLAB & login
![Page 70: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/70.jpg)
71
![Page 71: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/71.jpg)
72
Top five issues we hear about while working with Deep Neural
Networks
1. How do I choose a network architecture?
2. How much data do I need?
3. How do I improve accuracy of my network?
4. How do I speed up training?
5. I have a trained model – what do I do next?
![Page 72: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/72.jpg)
73
Intel Xeon Desktop PC Raspberry Pi Board
Android Phone
NVIDIA Jetson TX1 board
#5: Deploy on platform of choice
▪ Need code that takes advantage
of:
– NVIDIA® CUDA libraries, including
cuDNN and TensorRT
– Intel® Math Kernel Library for Deep
Neural Networks (MKL-DNN) for
Intel processors
– ARM® Compute library for ARM
processors
![Page 73: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/73.jpg)
74
#5: Easy deployment using a single network representation
GPU Coder
Target Libraries
ARM
Compute
Library
Intel
MKL-DNN
Library
Application
logic
TensorRT &
cuDNN
Libraries
MATLAB
Coder
![Page 74: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/74.jpg)
75
Summary- GPU Coder
MATLAB algorithm
(functional reference)
Functional test1 Deployment
unit-test
2
Desktop
GPU
C++
Deployment
integration-test
3
Desktop
GPU
C++
Real-time test4
Embedded GPU
.mex .lib Cross-compiled
.lib
Build type
Call CUDA
from MATLAB
directly
Call CUDA from
(C++) hand-
coded main()
Call CUDA from (C++)
hand-coded main().
![Page 75: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/75.jpg)
76
GPU Coder more than twice as fast as other frameworks
Intel® Xeon® CPU 3.6 GHz – Titan V. NVIDIA libraries: CUDA10.0/1 - cuDNN 7.4/5 - Frameworks: TensorFlow 1.13, MXNet 1.4.1 PyTorch 1.1.0
![Page 76: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/76.jpg)
77
Deep Learning is Versatile MATLAB Examples Available Here
![Page 77: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/77.jpg)
78
3 Takeaways and Questions?
▪ Deep Learning poses several challenges regarding data, pre-processing,
and training processes.
▪ Transfer learning needs relatively lesser data, and also possibly lower
training time, but has trade-offs.
▪ MATLAB also supports several hyperparameter tuning methods to optimize
the training process.
▪ MATLAB <3 Deep Learning
![Page 79: Deep Learning: Development to Deployment](https://reader033.fdocuments.us/reader033/viewer/2022042612/6263b8e3245da75e116a5135/html5/thumbnails/79.jpg)
80
Spandhana Gonuguntla, PhD
Education Technical Evangelist
Dr. Spandhana Gonuguntla, +91 7483479945
https://tinyurl.com/u3tuyop
Feedback form