This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Deep Learning with Images

Train convolutional neural networks from scratch or use pretrained networks to quickly learn new tasks

Create new deep networks for image classification and regression tasks by defining the network architecture and training the network from scratch. You can also use transfer learning to take advantage of the knowledge provided by a pretrained network to learn new patterns in new data. Fine-tuning a pretrained image classification network with transfer learning is typically much faster and easier than training from scratch. Using pretrained deep networks enables you to quickly learn new tasks without defining and training a new network, having millions of images, or having a powerful GPU.

After defining the network architecture, you must define training parameters using the trainingOptions function. You can then train the network using trainNetwork. Use the trained network to predict class labels or numeric responses.

You can train a convolutional neural network on a CPU, a GPU, multiple CPUs or GPUs, or in parallel on a cluster or in the cloud. Training on a GPU or in parallel requires Parallel Computing Toolbox™. Using a GPU requires a CUDA® enabled NVIDIA® GPU with compute capability 3.0 or higher. Specify the execution environment using the trainingOptions function.


Deep Network DesignerEdit and build deep learning networks


expand all

trainingOptionsOptions for training deep learning neural network
trainNetworkTrain neural network for deep learning
analyzeNetworkAnalyze deep learning network architecture
alexnetPretrained AlexNet convolutional neural network
vgg16Pretrained VGG-16 convolutional neural network
vgg19Pretrained VGG-19 convolutional neural network
squeezenetPretrained SqueezeNet convolutional neural network
googlenetPretrained GoogLeNet convolutional neural network
inceptionv3Pretrained Inception-v3 convolutional neural network
resnet18Pretrained ResNet-18 convolutional neural network
resnet50Pretrained ResNet-50 convolutional neural network
resnet101Pretrained ResNet-101 convolutional neural network
densenet201Pretrained DenseNet-201 convolutional neural network
inceptionresnetv2Pretrained Inception-ResNet-v2 convolutional neural network
imageInputLayerImage input layer
convolution2dLayer2-D convolutional layer
fullyConnectedLayerFully connected layer
reluLayerRectified Linear Unit (ReLU) layer
leakyReluLayerLeaky Rectified Linear Unit (ReLU) layer
clippedReluLayerClipped Rectified Linear Unit (ReLU) layer
batchNormalizationLayerBatch normalization layer
crossChannelNormalizationLayer Channel-wise local response normalization layer
dropoutLayerDropout layer
averagePooling2dLayerAverage pooling layer
maxPooling2dLayerMax pooling layer
maxUnpooling2dLayerMax unpooling layer
additionLayerAddition layer
depthConcatenationLayerDepth concatenation layer
softmaxLayerSoftmax layer
transposedConv2dLayerTransposed 2-D convolution layer
classificationLayerClassification output layer
regressionLayerCreate a regression output layer
augmentedImageDatastoreTransform batches to augment image data
imageDataAugmenterConfigure image data augmentation
augmentApply identical random transformations to multiple images
layerGraphGraph of network layers for deep learning
plotPlot neural network layer graph
addLayersAdd layers to layer graph
removeLayersRemove layers from layer graph
replaceLayerReplace layer in layer graph
connectLayersConnect layers in layer graph
disconnectLayersDisconnect layers in layer graph
DAGNetworkDirected acyclic graph (DAG) network for deep learning
classifyClassify data using a trained deep learning neural network
activationsCompute convolutional neural network layer activations
predictPredict responses using a trained deep learning neural network
confusionchartCreate confusion matrix chart for classification problem
ConfusionMatrixChart PropertiesConfusion matrix chart appearance and behavior
sortClassesSort classes of confusion matrix chart

Examples and How To

Use Pretrained Networks

Classify Image Using GoogLeNet

This example shows how to classify an image using the pretrained deep convolutional neural network GoogLeNet.

Classify Webcam Images Using Deep Learning

This example shows how to classify images from a webcam in real time using the pretrained deep convolutional neural network GoogLeNet.

Transfer Learning with Deep Network Designer

Interactively fine-tune a pretrained deep learning network to learn a new image classification task.

Train Deep Learning Network to Classify New Images

This example shows how to use transfer learning to retrain a convolutional neural network to classify a new set of images.

Transfer Learning Using AlexNet

This example shows how to fine-tune a pretrained AlexNet convolutional neural network to perform classification on a new collection of images.

Feature Extraction Using AlexNet

This example shows how to extract learned image features from a pretrained convolutional neural network, and use those features to train an image classifier.

Pretrained Convolutional Neural Networks

Learn how to download and use pretrained convolutional neural networks for classification, transfer learning and feature extraction.

Create New Deep Network

Create Simple Deep Learning Network for Classification

This example shows how to create and train a simple convolutional neural network for deep learning classification.

Build Networks with Deep Network Designer

Interactively build and edit deep learning networks.

Resume Training from Checkpoint Network

Learn how to save checkpoint networks while training a convolutional neural network and resume training from a previously saved network

Train Convolutional Neural Network for Regression

This example shows how to fit a regression model using convolutional neural networks to predict the angles of rotation of handwritten digits.

List of Deep Learning Layers

Discover all the deep learning layers in MATLAB®.

Specify Layers of Convolutional Neural Network

Learn about the layers of a convolutional neural network (ConvNet), and the order they appear in a ConvNet

Train Residual Network for Image Classification

This example shows how to create a deep learning neural network with residual connections and train it on CIFAR-10 data.


Deep Learning in MATLAB

Discover deep learning capabilities in MATLAB using convolutional neural networks for classification and regression, including pretrained networks and transfer learning, and training on GPUs, CPUs, clusters, and clouds.

Set Up Parameters and Train Convolutional Neural Network

Learn how to set up training parameters for a convolutional neural network

Deep Learning with Big Data on GPUs and in Parallel

Train deep networks on CPUs, GPUs, clusters, and clouds, and tune options to suit your hardware.

Preprocess Images for Deep Learning

Learn how to resize images for training, prediction and classification, and how to preprocess images using data augmentation and mini-batch datastores.

Convert Classification Network into Regression Network

This example shows how to convert a trained classification network into a regression network.

Deep Learning Tips and Tricks

Learn how to improve the accuracy of deep learning networks.

Featured Examples