Deep Learning Toolbox Users Guide Unknown pdf download
Deep Learning Toolbox Users Guide Unknown pdf download
download
https://ebookbell.com/product/deep-learning-toolbox-users-guide-
unknown-49158114
https://ebookbell.com/product/matlab-r2022b-deep-learning-toolbox-
users-guide-mark-hudson-46240934
Matlab R2023a Deep Learning Toolbox Users Guide Mark Hudson Beale
https://ebookbell.com/product/matlab-r2023a-deep-learning-toolbox-
users-guide-mark-hudson-beale-49478930
https://ebookbell.com/product/matlab-r2023a-deep-learning-hdl-toolbox-
users-guide-mathworks-49478982
Deep Learning Toolbox Getting Started Guide Matlab 143 The Mathworks
https://ebookbell.com/product/deep-learning-toolbox-getting-started-
guide-matlab-143-the-mathworks-43710832
Matlab R2022b Deep Learning Toolbox Getting Started Guide Mark Hudson
Beale Martin T Hagan Howard B Demuth
https://ebookbell.com/product/matlab-r2022b-deep-learning-toolbox-
getting-started-guide-mark-hudson-beale-martin-t-hagan-howard-b-
demuth-46231442
https://ebookbell.com/product/matlab-r2023a-deep-learning-toolbox-
reference-mark-hudson-beale-49478934
https://ebookbell.com/product/matlab-deep-learning-toolbox-reference-
mark-hudson-beale-martin-t-hagan-52253068
https://ebookbell.com/product/matlab-deep-learning-hdl-toolbox-ug-the-
mathworks-inc-36088316
https://ebookbell.com/product/deep-learning-ian-goodfellow-yoshua-
bengio-aaron-courville-44886094
Deep Learning Toolbox™
User's Guide
R2022b
How to Contact MathWorks
Phone: 508-647-7000
Deep Networks
1
Deep Learning in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
What Is Deep Learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Start Deep Learning Faster Using Transfer Learning . . . . . . . . . . . . . . . . 1-2
Deep Learning Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Deep Learning Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Train Classifiers Using Features Extracted from Pretrained Networks . . . 1-7
Deep Learning with Big Data on CPUs, GPUs, in Parallel, and on the Cloud
...................................................... 1-7
Deep Learning Using Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Deep Learning Interpretability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Deep Learning Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Deep Learning Import and Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
v
Set Up Parameters and Train Convolutional Neural Network . . . . . . . . . 1-64
Specify Solver and Maximum Number of Epochs . . . . . . . . . . . . . . . . . . 1-64
Specify and Modify Learning Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-64
Specify Validation Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-65
Select Hardware Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-65
Save Checkpoint Networks and Resume Training . . . . . . . . . . . . . . . . . . 1-66
Set Up Parameters in Convolutional and Fully Connected Layers . . . . . . 1-66
Train Your Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-66
vi Contents
Train Networks Using Deep Network Designer . . . . . . . . . . . . . . . . . . . . . 2-30
Select Training Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
Train Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-32
Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33
Train Network for Time Series Forecasting Using Deep Network Designer
......................................................... 2-58
vii
Train Convolutional Neural Network for Regression . . . . . . . . . . . . . . . . 3-49
viii Contents
Train Network with Complex-Valued Data . . . . . . . . . . . . . . . . . . . . . . . . . 4-60
Classify Videos Using Deep Learning with Custom Training Loop . . . . . 4-96
ix
Time Series Prediction in Simulink Using Deep Learning Network . . . 4-351
x Contents
Monitor Deep Learning Training Progress . . . . . . . . . . . . . . . . . . . . . . . 5-151
Monitor GAN Training Progress and Identify Common Failure Modes 5-229
Convergence Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-229
Mode Collapse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-231
xi
Try Multiple Pretrained Networks for Transfer Learning . . . . . . . . . . . . 6-40
xii Contents
Deep Learning with Big Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
Work with Big Data in Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
Preprocess Data in Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
Work with Big Data in the Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
Preprocess Data for Custom Training Loops . . . . . . . . . . . . . . . . . . . . . . 7-19
Activity Recognition from Video and Optical Flow Data Using Deep
Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-49
xiii
Import Pretrained ONNX YOLO v2 Object Detector . . . . . . . . . . . . . . . . . 8-77
xiv Contents
Classify Tumors in Multiresolution Blocked Images . . . . . . . . . . . . . . . . 9-85
Lidar Examples
11
Code Generation for Lidar Object Detection Using SqueezeSegV2
Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
xv
Code Generation For Aerial Lidar Semantic Segmentation Using PointNet
++ Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-35
Classify Time Series Using Wavelet Analysis and Deep Learning . . . . . 12-77
xvi Contents
Wireless Comm Examples
13
Train DQN Agent for Beam Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
Test a Deep Neural Network with Captured Data to Detect WLAN Router
Impersonation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-156
Audio Examples
14
Transfer Learning with Pretrained Audio Networks . . . . . . . . . . . . . . . . . 14-2
xvii
Keyword Spotting in Noise Code Generation with Intel MKL-DNN . . . 14-90
Train 3-D Sound Event Localization and Detection (SELD) Using Deep
Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-361
xviii Contents
3-D Speech Enhancement Using Trained Filter and Sum Network . . . 14-432
Create Agent Using Deep Network Designer and Train Using Image
Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-25
Train DQN Agent for Lane Keeping Assist Using Parallel Computing . 15-80
xix
Remaining Useful Life Estimation Using Convolutional Neural Network
........................................................ 16-23
xx Contents
Define Custom Deep Learning Output Layers . . . . . . . . . . . . . . . . . . . . . 18-31
Output Layer Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-31
Output Layer Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-31
Custom Layer Acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-33
Output Layer Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-34
Forward Loss Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-35
Backward Loss Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-35
GPU Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-37
Check Validity of Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-37
xxi
Define Custom Classification Output Layer . . . . . . . . . . . . . . . . . . . . . . . 18-99
Classification Output Layer Template . . . . . . . . . . . . . . . . . . . . . . . . . . 18-99
Name the Layer and Specify Superclasses . . . . . . . . . . . . . . . . . . . . . 18-100
Declare Layer Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-101
Create Constructor Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-101
Create Forward Loss Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-102
Completed Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-103
GPU Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-104
Check Output Layer Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-104
Include Custom Classification Output Layer in Network . . . . . . . . . . . 18-104
xxii Contents
Name Layer and Specify Superclasses . . . . . . . . . . . . . . . . . . . . . . . . 18-157
Specify Code Generation Pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-158
Declare Properties and Learnable Parameters . . . . . . . . . . . . . . . . . . 18-158
Create Constructor Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-160
Create Forward Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-161
Completed Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-163
Check Custom Layer for Code Generation Compatibility . . . . . . . . . . . 18-164
xxiii
Define Model Loss Function for Custom Training Loop . . . . . . . . . . . . 18-245
Create Model Loss Function for Model Defined as dlnetwork Object . . 18-245
Create Model Loss Function for Model Defined as Function . . . . . . . . 18-245
Evaluate Model Loss Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-246
Update Learnable Parameters Using Gradients . . . . . . . . . . . . . . . . . . 18-246
Use Model Loss Function in Custom Training Loop . . . . . . . . . . . . . . . 18-247
Debug Model Loss Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-247
xxiv Contents
Node Classification Using Graph Convolutional Network . . . . . . . . . . 18-393
xxv
Deep Learning Data Preprocessing
19
Datastores for Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2
Select Datastore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2
Input Datastore for Training, Validation, and Inference . . . . . . . . . . . . . . 19-3
Specify Read Size and Mini-Batch Size . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5
Transform and Combine Datastores . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6
Use Datastore for Parallel Training and Background Dispatching . . . . . . 19-8
xxvi Contents
Classify Out-of-Memory Text Data Using Deep Learning . . . . . . . . . . . 19-106
xxvii
Deep Learning Prediction with ARM Compute Using codegen . . . . . . . 20-90
Deep Learning Code Generation on Intel Targets for Different Batch Sizes
........................................................ 20-95
Generate C++ Code for Object Detection Using YOLO v2 and Intel MKL-
DNN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-104
Code Generation for LSTM Network That Uses Intel MKL-DNN . . . . . 20-136
Cross Compile Deep Learning Code for ARM Neon Targets . . . . . . . . 20-140
xxviii Contents
Generate Code for TensorFlow Lite (TFLite) Model and Deploy on
Raspberry Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-247
xxix
Choose Neural Network Input-Output Processing Functions . . . . . . . . . 22-7
Representing Unknown or Don't-Care Targets . . . . . . . . . . . . . . . . . . . . 22-8
xxx Contents
Multistep Neural Network Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-52
Set Up in Open-Loop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-52
Multistep Closed-Loop Prediction From Initial Conditions . . . . . . . . . . . 23-53
Multistep Closed-Loop Prediction Following Known Sequence . . . . . . . 23-54
Following Closed-Loop Simulation with Open-Loop Simulation . . . . . . . 23-55
Control Systems
24
Introduction to Neural Network Control Systems . . . . . . . . . . . . . . . . . . 24-2
xxxi
Self-Organizing and Learning Vector Quantization Networks
26
Introduction to Self-Organizing and LVQ . . . . . . . . . . . . . . . . . . . . . . . . . 26-2
Important Self-Organizing and LVQ Functions . . . . . . . . . . . . . . . . . . . . . 26-2
Advanced Topics
28
Shallow Neural Networks with Parallel and GPU Computing . . . . . . . . . 28-2
Modes of Parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-2
Distributed Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-2
Single GPU Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-4
Distributed GPU Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-6
xxxii Contents
Parallel Time Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-8
Parallel Availability, Fallbacks, and Feedback . . . . . . . . . . . . . . . . . . . . . 28-8
xxxiii
Perceptron Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29-4
Create a Perceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29-5
Perceptron Learning Rule (learnp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29-6
Training (train) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29-8
Limitations and Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29-12
Classify Patterns Using the Neural Net Pattern Recognition App . . . . 31-11
Fit Time Series Data Using the Neural Net Time Series App . . . . . . . . 31-26
xxxiv Contents
Wine Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31-51
xxxv
Too Large a Learning Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31-198
Mathematical Notation
A
Mathematics and Code Equivalents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Mathematics Notation to MATLAB Notation . . . . . . . . . . . . . . . . . . . . . . . A-2
Figure Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Code Notes
C
Deep Learning Toolbox Data Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
xxxvi Contents
1
Deep Networks
Deep Learning Toolbox provides simple MATLAB commands for creating and interconnecting the
layers of a deep neural network. Examples and pretrained networks make it easy to use MATLAB for
deep learning, even without knowledge of advanced computer vision algorithms or neural networks.
For a free hands-on introduction to practical deep learning methods, see Deep Learning Onramp. To
quickly get started deep learning, see “Try Deep Learning in 10 Lines of MATLAB Code”.
To choose whether to use a pretrained network or create a new deep network, consider the scenarios
in this table.
1-2
Deep Learning in MATLAB
1-3
1 Deep Networks
For example, use deep learning for “Train a Deep Learning Vehicle
vehicle detection and semantic Detector” on page 10-2
segmentation.
Signal Apply deep learning to signal “Signal Processing Using Deep
processin processing applications. Learning”
g
For example, use deep learning for “Classify Time Series Using Wavelet
waveform segmentation, signal Analysis and Deep Learning” on
classification, and denoising speech page 12-77
signals.
Wireless Apply deep learning to wireless “Wireless Communications Using
communi communications systems. Deep Learning”
cations
For example, use deep learning for “Spectrum Sensing with Deep
positioning, spectrum sensing, Learning to Identify 5G and LTE
autoencoder design, and digital Signals” on page 13-85
predistortion (DPD).
“Three-Dimensional Indoor
Positioning with 802.11az
Fingerprinting and Deep Learning”
(WLAN Toolbox)
Reinforce Train deep neural network agents “Reinforcement Learning Using
ment by interacting with an unknown Deep Neural Networks”
learning dynamic environment.
1-4
Deep Learning in MATLAB
For example, use deep learning for “Classify Text Data Using Deep
text classification, language Learning” on page 4-193
translation, and text generation.
Predictive Apply deep learning to predictive “Predictive Maintenance Using
maintena maintenance applications. Deep Learning”
nce
For example, use deep learning for “Chemical Process Fault Detection
fault detection and remaining useful Using Deep Learning” on page 16-
life estimation. 2
You can process your data before training using apps to label ground truth data. For more
information on choosing a labeling app, see “Choose an App to Label Ground Truth Data” on page 19-
163.
1-5
1 Deep Networks
Image Labeler Label ground truth data in a “Get Started with the Image
collection of images. Labeler” (Computer Vision
Toolbox)
Video Labeler Label ground truth data in a “Get Started with the Video
video, in an image Labeler” (Computer Vision
sequence, or from a custom Toolbox)
data source reader.
Ground Truth Labeler Label ground truth data in “Get Started with Ground
multiple videos, image Truth Labelling”
sequences, or lidar point (Automated Driving
clouds. Toolbox)
Lidar Labeler Label objects in a point “Get Started with the Lidar
cloud or a point cloud Labeler” (Lidar Toolbox)
sequence. The app reads
point cloud data from PLY,
PCAP, LAS, LAZ, ROS and
PCD files.
Signal Labeler Label signals for analysis or “Using Signal Labeler App”
for use in machine learning (Signal Processing Toolbox)
and deep learning
applications.
1-6
Deep Learning in MATLAB
For an example, see “Extract Image Features Using Pretrained Network” on page 3-24.
Deep Learning with Big Data on CPUs, GPUs, in Parallel, and on the
Cloud
Training deep networks is computationally intensive and can take many hours of computing time;
however, neural networks are inherently parallel algorithms. You can use Parallel Computing
Toolbox™ to take advantage of this parallelism by running in parallel using high-performance GPUs
and computer clusters. To learn more about deep learning in parallel, in the cloud, or using a GPU,
see “Scale Up Deep Learning in Parallel, on GPUs, and in the Cloud” on page 7-2.
Datastores in MATLAB® are a convenient way of working with and representing collections of data
that are too large to fit in memory at one time. To learn more about deep learning with large data
sets, see “Deep Learning with Big Data” on page 7-18.
Block Description
Image Classifier Classify data using a trained deep learning neural
network
Predict Predict responses using a trained deep learning
neural network
1-7
1 Deep Networks
Block Description
Stateful Classify Classify data using a trained deep learning
recurrent neural network
Stateful Predict Predict responses using a trained recurrent
neural network
Deep Learning Object Detector Detect objects using trained deep learning object
detector
The Deep Learning Toolbox provides several deep learning visualization methods to help you
investigate and understand network behaviour. For example, gradCAM, occlusionSensitivity,
and imageLIME. For more information, see “Deep Learning Visualization Methods” on page 5-233.
1-8
Deep Learning in MATLAB
For more information, see “Train Deep Learning Model in MATLAB” on page 18-3.
Import Functions
External Deep Learning Import Model as Network Import Model as Layer Graph
Platform and Model Format
TensorFlow network in importTensorFlowNetwork importTensorFlowLayers
SavedModel format
TensorFlow-Keras network in importKerasNetwork importKerasLayers
HDF5 or JSON format
traced PyTorch model in .pt file importNetworkFromPyTorch Not applicable
Network in ONNX model format importONNXNetwork importONNXLayers
1-9
1 Deep Networks
Export Functions
Export Network or Layer Graph External Deep Learning Platform and Model
Format
exportNetworkToTensorFlow TensorFlow 2 model in Python® package
exportONNXNetwork ONNX model format
The exportNetworkToTensorFlow function saves a Deep Learning Toolbox network or layer graph
as a TensorFlow model in a Python package. For more information on how to load the exported model
and save it in a standard TensorFlow format, see “Load Exported TensorFlow Model” and “Save
Exported TensorFlow Model in Standard Format”.
By using ONNX as an intermediate format, you can interoperate with other deep learning frameworks
that support ONNX model export or import.
See Also
Related Examples
• “Classify Webcam Images Using Deep Learning” on page 3-2
• “Transfer Learning with Deep Network Designer” on page 2-2
• “Pretrained Deep Neural Networks” on page 1-11
• “Create Simple Deep Learning Network for Classification” on page 3-43
• “Example Deep Learning Networks Architectures” on page 1-23
• “Deep Learning Tips and Tricks” on page 1-87
1-10
Pretrained Deep Neural Networks
In this section...
“Compare Pretrained Networks” on page 1-12
“Load Pretrained Networks” on page 1-13
“Visualize Pretrained Networks” on page 1-14
“Feature Extraction” on page 1-16
“Transfer Learning” on page 1-17
“Import and Export Networks” on page 1-17
“Pretrained Networks for Audio Applications” on page 1-18
“Pretrained Models on GitHub” on page 1-19
You can take a pretrained image classification network that has already learned to extract powerful
and informative features from natural images and use it as a starting point to learn a new task. The
majority of the pretrained networks are trained on a subset of the ImageNet database [1], which is
used in the ImageNet Large-Scale Visual Recognition Challenge (ILSVRC) [2]. These networks have
been trained on more than a million images and can classify images into 1000 object categories, such
as keyboard, coffee mug, pencil, and many animals. Using a pretrained network with transfer
learning is typically much faster and easier than training a network from scratch.
You can use previously trained networks for the following tasks:
Purpose Description
Classification Apply pretrained networks directly to
classification problems. To classify a new image,
use classify. For an example showing how to
use a pretrained network for classification, see
“Classify Image Using GoogLeNet” on page 3-
19.
Feature Extraction Use a pretrained network as a feature extractor
by using the layer activations as features. You can
use these activations as features to train another
machine learning model, such as a support vector
machine (SVM). For more information, see
“Feature Extraction” on page 1-16. For an
example, see “Extract Image Features Using
Pretrained Network” on page 3-24.
Transfer Learning Take layers from a network trained on a large
data set and fine-tune on a new data set. For
more information, see “Transfer Learning” on
page 1-17. For a simple example, see “Get
Started with Transfer Learning”. To try more
pretrained networks, see “Train Deep Learning
Network to Classify New Images” on page 3-6.
1-11
1 Deep Networks
Tip To get started with transfer learning, try choosing one of the faster networks, such as
SqueezeNet or GoogLeNet. You can then iterate quickly and try out different settings such as data
preprocessing steps and training options. Once you have a feeling of which settings work well, try a
more accurate network such as Inception-v3 or a ResNet and see if that improves your results.
Note The plot above only shows an indication of the relative speeds of the different networks. The
exact prediction and training iteration times depend on the hardware and mini-batch size that you
use.
A good network has a high accuracy and is fast. The plot displays the classification accuracy versus
the prediction time when using a modern GPU (an NVIDIA® Tesla® P100) and a mini-batch size of
128. The prediction time is measured relative to the fastest network. The area of each marker is
proportional to the size of the network on disk.
The classification accuracy on the ImageNet validation set is the most common way to measure the
accuracy of networks trained on ImageNet. Networks that are accurate on ImageNet are also often
accurate when you apply them to other natural image data sets using transfer learning or feature
1-12
Pretrained Deep Neural Networks
extraction. This generalization is possible because the networks have learned to extract powerful and
informative features from natural images that generalize to other similar data sets. However, high
accuracy on ImageNet does not always transfer directly to other tasks, so it is a good idea to try
multiple networks.
If you want to perform prediction using constrained hardware or distribute networks over the
Internet, then also consider the size of the network on disk and in memory.
Network Accuracy
There are multiple ways to calculate the classification accuracy on the ImageNet validation set and
different sources use different methods. Sometimes an ensemble of multiple models is used and
sometimes each image is evaluated multiple times using multiple crops. Sometimes the top-5
accuracy instead of the standard (top-1) accuracy is quoted. Because of these differences, it is often
not possible to directly compare the accuracies from different sources. The accuracies of pretrained
networks in Deep Learning Toolbox are standard (top-1) accuracies using a single model and single
central image crop.
net = squeezenet;
For other networks, use functions such as googlenet to get links to download pretrained networks
from the Add-On Explorer.
The following table lists the available pretrained networks trained on ImageNet and some of their
properties. The network depth is defined as the largest number of sequential convolutional or fully
connected layers on a path from the input layer to the output layer. The inputs to all networks are
RGB images.
1-13
1 Deep Networks
*The NASNet-Mobile and NASNet-Large networks do not consist of a linear sequence of modules.
The standard GoogLeNet network is trained on the ImageNet data set but you can also load a
network trained on the Places365 data set [3] [4]. The network trained on Places365 classifies images
into 365 different place categories, such as field, park, runway, and lobby. To load a pretrained
GoogLeNet network trained on the Places365 data set, use
googlenet('Weights','places365'). When performing transfer learning to perform a new task,
the most common approach is to use networks pretrained on ImageNet. If the new task is similar to
classifying scenes, then using the network trained on Places365 could give higher accuracies.
For information about pretrained networks suitable for audio tasks, see “Pretrained Networks for
Audio Applications” on page 1-18.
deepNetworkDesigner(squeezenet)
1-14
Random documents with unrelated
content Scribd suggests to you:
Every candle went out—but stars! As they did, the
great pink cake exploded with such force that half the
Courtiers were flung under the table and the rest
knocked unconscious by flying fragments of icing,
tumblers and plates.
30
Chapter 2
Picking a Proper Princess
“What shall we do first?” groaned the King, holding
his head with both hands. “Let me think!”
So the great hall was cleared and the King, with the
mysterious scroll spread out before him, thought and
thought and thought. But he did not make much 31
headway, for, as he explained over and over to
Queen Pozy, who—with Pompadore, the Elegant
Elephant and the Prime Pumper—had remained to help
him, “How is one to know where to find the Proper
Princess, and how is one to know the proper time for
Pompa to wed her?”
Who was J.G.? How did the scroll get in the cake?
Elegant Elephant.
And when Pompus snatched the mirror, above his
reflection stood the words:
Lovely Queen.
“You think I’m fat and old, do you!” snorted the King,
flinging the gold mirror face down on the table. “This is
a nice day, I must say! Scrolls, door knobs, mirrors and
insults!”
42
“Flinging his arms affectionately around the Elegant
Elephant’s trunk”
43
“Fiddlesticks!” choked Kabumpo. “She’ll make a door
mat of you, Pompa—Prince Pompadormat—that’s what
you’ll be! Let’s run away!” he proposed, his little eyes
twinkling anxiously.
44
Chapter 3
Kabumpo and Pompa Disappear
Once in his own apartment, Kabumpo pulled the bell
rope furiously.
“Yes, Sir! Are you going out, Sir?” murmured the little 45
Pumperdinkian, hastening to a great chest in the corner
of the big marble room, to get out of the robe.
ebookbell.com