Deep LearningINAF With MATLAB
Deep LearningINAF With MATLAB
Giuseppe Ridinò
Senior Application Engineer
MathWorks Italy
2
TNG Data Project and Jupyterlab Interface
Project: http://www.tng-project.org/
Jupyterlab: tng-project.org/data/lab/
Scripts: http://www.tng-
project.org/data/docs/scripts/
3
MATLAB Community Tools for Astronomy
https://www.mathworks.com/matlabcentral/fileexchange?sort=downloads_desc&q=astronomy
4
LIGO: Spot 1st-Ever Gravitational Waves with MATLAB
Article
Blog post
5
NASA Build Kepler Pipeline tools with MATLAB
download: github.com/nasa/kepler-pipeline
6
Agenda
Images Signals
K-means SVM
8
Machine Learning and Deep Learning
Machine Learning
Unsupervised
Learning
[No Labeled Data]
Clustering
9
Machine Learning and Deep Learning
Machine Learning
10
Machine Learning and Deep Learning
Machine Learning
Deep Learning
Deep learning typically does not
involve feature extraction
11
What is Deep Learning?
12
Deep Learning
Deep Learning
Machine
Learning
Deep
Learning
13
Deep Learning uses a neural network architecture
Input Output
Hidden Layers (n)
Layer Layer
14
Deep Learning datatypes
Image Signal
Text
Numeric
15
Example 1: Detection and localization using deep learning
16
Example 2: Analyzing signal data using deep learning
Deep Learning
18
Deep Learning workflow
Hardware-
Simulation-based Enterprise
accelerated
data generation Deployment
training
19
Agenda
Images Signals
21
Using Apps for designing Deep Learning networks
22
Different Neural Networks for Different Data
23
Types of Data
24
Convolutional Neural Networks (CNN)
Edges
Shapes
Objects
25
CNN Visualization methods
26
Another network for signals - LSTM
c0 C1 Ct
27
Combining convolution and recurrent layers
Learn spatial and temporal features simultaneously
Response
CNN LSTM Class 1
class label
28
Agenda
Images Signals
Images Signals
31
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
32
Semantic Segmentation Network
Boat
Airplane
Other classes
33
Semantic Segmentation Network
34
Example: Semantic Segmentation for Free Road
Detection
35
1. Use CamVid dataset
36
2. Balance classes using class weighting
37
3. Split dataset
38
4. Define network
91x1 Layer array with layers:
40
Useful tools for Semantic Segmentation
▪ Automatically create network structures
– Using segnetLayers and fcnLayers
41
Agenda
Images Signals
Time-Frequency Transformation
Long Short Term Memory (LSTM) Networks
Feature Engineering
43
Example: Speech Recognition
44
1. Create Datastore
▪ Datastore creates
reference for data
45
2. Compute speech spectrograms
Amplitude
Frequency
Time
46
3. Split datastores
47
4. Define architecture and parameters
Model Parameters
Neural Network Architecture
48
5. Train network
49
Training is an iterative process
50
Agenda
Images Signals
but necessary
52
Ground truth labeling for images and video
“How do I label
my data?”
App for
Ground Truth
Labeling
Label regions
and pixels for
semantic
segmentation
53
Ground truth labeling for signals and audio
“How do I label
my data?”
54
MATLAB Apps help you speed up labeling work
55
MATLAB Apps help you speed up labeling work
1. Audio Labeler
(Audio Toolbox)
https://www.mathworks.com/help/audio/ug/au
dio-labeler-walkthrough.html
2. Signal Labeler
(Signal Processing Toolbox)
https://www.mathworks.com/help/signal/ref/si
gnallabeler.html
56
Agenda
Images Signals
MATLAB Python
58
Three use cases for model exchange
59
Model exchange with MATLAB
PyTorch Keras-
Tensorflow
Caffe2
Core ML
Caffe
CNTK (…)
Source: https://onnx.ai/
61
Transfer Learning with Pretrained Models
Images Signals
64
Deep Learning on CPU, GPU, Multi-GPU and Clusters
HOW TO TA R G E T ?
Option Parallel Computing Toolbox MATLAB Parallel Server (formally called MDCS)
Desktop Custom Cloud User-managed Cloud Pre-configured Cloud Custom Cloud On Premise
Reference Cloud Center Hosting Providers Reference
Architecture Architecture
Description Explicit desktop Explicit desktop Preconfigured clusters in Cloud solutions from Custom infrastructure Scale to clusters in your
scaling scaling Amazon Web Services MathWorks partners for AWS, Azure, and organization
others
When to Prototyping, small Data in cloud, access User-centric workflows, Managed environments with Internally-managed Traditional scaling on
use scaling high-end machines, small studies operating expense rather environments with assets you manage at
especially with GPUs than capital expense operating expense your facilities
rather than capital
expense
Maximum Physical cores in Physical cores in 1024 per cluster Defined by Hosting Provider No limit Physical cores in cluster
workers machine machine
http://www.mathworks.com/programs/mdcs-cloud.html 66
Cloud Reference Architecture: MATLAB & Simulink
Virtual Network
Use cases:
Remote • Data analytics on cloud-stored data
Desktop • Access to high-end hardware:
Client − multi-core
− GPUs
− FPGAs
• Prototyping parallel algorithms
• On-server pre-production testing
67
Reference Architecture: MATLAB Distributed Computing Server
Virtual Network
Head node VM
with MATLAB job scheduler
Use cases:
• Parameter sweeps
• Monte Carlo runs
• Optimization
Client with MATLAB and • Distributed array calculations
Parallel Computing Toolbox
Compute node
VMs
MathWorks Hosted
License Manager
68
NVIDIA NGC & DGX Supports MATLAB for Deep Learning
69
Inference Performance and Deployment
70
Deployment process
Hardware-
Simulation-based Enterprise
accelerated
data generation Deployment
training
71
Deploying Deep Learning models for inference
Intel
MKL-DNN
Library
NVIDIA
Coder GPU Coder TensorRT &
Products cuDNN
Libraries
Deep Learning
Networks
ARM
Compute
Library
72
Deploying to HW targets
Desktop CPU
NVIDIA
Coder GPU Coder TensorRT &
Products cuDNN
Libraries
Deep Learning
Networks
Raspberry Pi board
73
With GPU Coder, MATLAB is fast
TensorFlow
MXNet
GPU Coder
PyTorch
Intel® Xeon® CPU 3.6 GHz - NVIDIA libraries: CUDA10 - cuDNN 7 - Frameworks: TensorFlow 1.13.0, MXNet 1.4.0 PyTorch 1.0.0 74
Semantic Segmentation speedup
75
Blog: Deep Learning
http://blogs.mathworks.com/deep-learning/
76
Introduction to Deep Learning
http://www.mathworks.com/videos/series/introduction-to-deep-learning.html
77
Deep Learning with MATLAB
http://www.mathworks.com/videos/series/deep-learning-with-MATLAB.html
78
Deep Learning Onramp
http://www.mathworks.com/learn/tutorials/deep-learning-onramp.html
79
Thank you!
80