Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

图像深度学习

从头开始训练卷积神经网络或使用预训练的网络快速学习新任务

您可以通过定义网络架构并从头开始训练网络,来创建新的用于图像分类和回归任务的深度网络。您还可以使用迁移学习以利用预训练网络所提供的知识来学习新数据中的新模式。通常来说,使用迁移学习对预训练的图像分类网络进行微调比从头开始训练更快更容易。使用预训练的深度网络,您可以快速学习新任务,而无需定义和训练新网络,也不需要使用数百万个图像或强大的 GPU。

定义网络架构后,必须使用 trainingOptions 函数定义训练参数。然后,您可以使用 trainNetwork 训练网络。使用经过训练的网络预测类标签或数值响应。

您可以在一个 CPU、一个 GPU、多个 CPU 或 GPU 上训练卷积神经网络,或者在群集中并行训练或在云中训练。在 GPU 上训练或并行训练需要 Parallel Computing Toolbox™。使用 GPU 需要支持的 GPU 设备(有关受支持设备的信息,请参阅GPU Support by Release (Parallel Computing Toolbox))。使用 trainingOptions 函数指定执行环境。

App

深度网络设计器Design, visualize, and train deep learning networks

函数

全部展开

trainingOptionsOptions for training deep learning neural network
trainNetworkTrain deep learning neural network
analyzeNetworkAnalyze deep learning network architecture
squeezenetSqueezeNet convolutional neural network
googlenetGoogLeNet convolutional neural network
inceptionv3Inception-v3 convolutional neural network
densenet201DenseNet-201 convolutional neural network
mobilenetv2MobileNet-v2 convolutional neural network
resnet18ResNet-18 convolutional neural network
resnet50ResNet-50 convolutional neural network
resnet101ResNet-101 convolutional neural network
xceptionXception convolutional neural network
inceptionresnetv2Pretrained Inception-ResNet-v2 convolutional neural network
nasnetlargePretrained NASNet-Large convolutional neural network
nasnetmobilePretrained NASNet-Mobile convolutional neural network
shufflenetPretrained ShuffleNet convolutional neural network
darknet19DarkNet-19 convolutional neural network
darknet53DarkNet-53 convolutional neural network
efficientnetb0EfficientNet-b0 convolutional neural network
alexnetAlexNet convolutional neural network
vgg16VGG-16 convolutional neural network
vgg19VGG-19 convolutional neural network

输入层

imageInputLayerImage input layer
image3dInputLayer3-D image input layer
featureInputLayerFeature input layer

卷积和全连接层

convolution2dLayer2-D convolutional layer
convolution3dLayer3-D convolutional layer
groupedConvolution2dLayer2-D grouped convolutional layer
transposedConv2dLayerTransposed 2-D convolution layer
transposedConv3dLayerTransposed 3-D convolution layer
fullyConnectedLayerFully connected layer

激活层

reluLayerRectified Linear Unit (ReLU) layer
leakyReluLayerLeaky Rectified Linear Unit (ReLU) layer
clippedReluLayerClipped Rectified Linear Unit (ReLU) layer
eluLayerExponential linear unit (ELU) layer
tanhLayerHyperbolic tangent (tanh) layer
swishLayerSwish layer

归一化、丢弃和裁剪层

batchNormalizationLayerBatch normalization layer
groupNormalizationLayerGroup normalization layer
instanceNormalizationLayerInstance normalization layer
layerNormalizationLayerLayer normalization layer
crossChannelNormalizationLayer Channel-wise local response normalization layer
dropoutLayerDropout layer
crop2dLayer2-D crop layer
crop3dLayer3-D crop layer

池化和去池化层

averagePooling2dLayerAverage pooling layer
averagePooling3dLayer3-D average pooling layer
globalAveragePooling2dLayerGlobal average pooling layer
globalAveragePooling3dLayer3-D global average pooling layer
globalMaxPooling2dLayerGlobal max pooling layer
globalMaxPooling3dLayer3-D global max pooling layer
maxPooling2dLayerMax pooling layer
maxPooling3dLayer3-D max pooling layer
maxUnpooling2dLayerMax unpooling layer

组合层

additionLayerAddition layer
multiplicationLayerMultiplication layer
concatenationLayerConcatenation layer
depthConcatenationLayerDepth concatenation layer

输出层

sigmoidLayerSigmoid layer
softmaxLayerSoftmax 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
isequalCheck equality of deep learning layer graphs or networks
isequalnCheck equality of deep learning layer graphs or networks ignoring NaN values
classifyClassify data using a trained deep learning neural network
predictPredict responses using a trained deep learning neural network
activationsCompute deep learning network layer activations
confusionchartCreate confusion matrix chart for classification problem
sortClassesSort classes of confusion matrix chart

模块

全部展开

PredictPredict responses using a trained deep learning neural network
Image ClassifierClassify data using a trained deep learning neural network

属性

ConfusionMatrixChart PropertiesConfusion matrix chart appearance and behavior

示例和操作指南

使用预训练网络

使用 GoogLeNet 对图像进行分类

此示例说明如何使用预训练的深度卷积神经网络 GoogLeNet 对图像进行分类。

使用深度学习对网络摄像头图像进行分类

此示例说明如何使用预训练的深度卷积神经网络 GoogLeNet 实时对来自网络摄像头的图像进行分类。

使用深度网络设计器进行迁移学习

以交互方式微调预训练的深度学习网络以学习新的图像分类任务。

训练深度学习网络以对新图像进行分类

此示例说明如何使用迁移学习来重新训练卷积神经网络以对新图像集进行分类。

使用预训练网络提取图像特征

此示例说明如何从预训练的卷积神经网络中提取已学习的图像特征,并使用这些特征来训练图像分类器。特征提取是使用预训练深度网络的表征能力的最简单最快捷的方式。例如,您可以使用 fitcecoc(Statistics and Machine Learning Toolbox™) 基于提取的特征来训练支持向量机 (SVM)。由于特征提取只需要遍历一次数据,因此如果没有 GPU 来加速网络训练,则不妨从特征提取开始。

Transfer Learning Using Pretrained Network

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

预训练的深度神经网络

了解如何下载和使用预训练的卷积神经网络进行分类、迁移学习和特征提取。

创建新的深度网络

创建简单的深度学习网络以用于分类

此示例说明如何创建和训练简单的卷积神经网络来进行深度学习分类。卷积神经网络是深度学习的基本工具,尤其适用于图像识别。

使用深度网络设计器构建网络

以交互方式构建和编辑深度学习网络。

针对回归训练卷积神经网络

此示例说明如何使用卷积神经网络拟合回归模型来预测手写数字的旋转角度。

深度学习层列表

探索 MATLAB® 中的所有深度学习层。

指定卷积神经网络的层

了解卷积神经网络 (ConvNet) 的层,以及它们在 ConvNet 中出现的顺序。

Generate MATLAB Code from Deep Network Designer

Generate MATLAB code to recreate designing and training a network in Deep Network Designer.

训练残差网络进行图像分类

此示例说明如何创建包含残差连接的深度学习神经网络,并针对 CIFAR-10 数据对其进行训练。残差连接是卷积神经网络架构中的常见元素。使用残差连接可以改善网络中的梯度流,从而可以训练更深的网络。

Train Network with Numeric Features

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

Multiple-Input and Multiple-Output Networks

Learn how to define and train deep learning networks with multiple inputs or multiple outputs.

训练生成对抗网络 (GAN)

此示例说明如何训练生成对抗网络来生成图像。

Train Conditional Generative Adversarial Network (CGAN)

This example shows how to train a conditional generative adversarial network to generate images.

Train Fast Style Transfer Network

This example shows how to train a network to transfer the style of an image to a second image.

Image Captioning Using Attention

This example shows how to train a deep learning model for image captioning using attention.

Train Network Using Custom Training Loop

This example shows how to train a network that classifies handwritten digits with a custom learning rate schedule.

Train Network with Multiple Outputs

This example shows how to train a deep learning network with multiple outputs that predict both labels and angles of rotations of handwritten digits.

Train a Siamese Network to Compare Images

This example shows how to train a Siamese network to identify similar images of handwritten characters.

Import Custom Layer into Deep Network Designer

This example shows how to import a custom classification output layer with the sum of squares error (SSE) loss and add it to a pretrained network in Deep Network Designer.

Image-to-Image Regression in Deep Network Designer

This example shows how to use Deep Network Designer to construct and train an image-to-image regression network for super resolution.

概念

在 MATLAB 中进行深度学习

通过使用卷积神经网络进行分类和回归来探索 MATLAB 的深度学习能力,包括预训练网络和迁移学习,以及在 GPU、CPU、群集和云上进行训练。

设置参数并训练卷积神经网络

了解如何为卷积神经网络设置训练参数。

预处理图像以进行深度学习

了解如何调整图像大小以进行训练、预测和分类,以及如何使用数据增强、变换和专用数据存储对图像进行预处理。

Preprocess Volumes for Deep Learning

Read and preprocess volumetric image and label data for 3-D deep learning.

Datastores for Deep Learning

Learn how to use datastores in deep learning applications.

将分类网络转换为回归网络

此示例说明如何将经过训练的分类网络转换为回归网络。

Deep Learning Tips and Tricks

Learn how to improve the accuracy of deep learning networks.

Data Sets for Deep Learning

Discover data sets for various deep learning tasks.

Import Data into Deep Network Designer

Import and visualize data in Deep Network Designer.

特色示例