本文介绍如何使用 Azure 机器学习设计器中的 ResNet 模块来通过 ResNet 算法创建图像分类模型。This article describes how to use the ResNet module in Azure Machine Learning designer, to create an image classification model using the ResNet algorithm..

此分类算法是一种监督式学习方法,需要一个标记的数据集。This classification algorithm is a supervised learning method, and requires a labeled dataset. 若要详细了解如何获取带标记的图像目录,请参阅转换为图像目录Refer to Convert to Image Directory module for more information about how to get a labeled image directory. 可通过提供模型和带标记的图像目录作为训练 Pytorch 模型模块的输入来训练模型。You can train the model by providing a model and a labeled image directory as inputs to Train Pytorch Model. 然后,可使用训练后的模型来预测使用为图像模型评分的新输入示例的值。The trained model can then be used to predict values for the new input examples using Score Image Model.

关于 ResNet 的详细信息More about ResNet

请参阅本文,详细了解 ResNet。Refer to this paper for more details about ResNet.

如何配置 ResNetHow to configure ResNet

  1. 在设计器中将 ResNet 模块添加到管道。Add the ResNet module to your pipeline in the designer.

  2. 对于“模型名称”,指定特定 ResNet 结构的名称,然后可以从支持的 resnet 中进行选择:“resnet18”、“resnet34”、“resnet50”、“resnet101”、“resnet152”、“resnet152”、“resnext50_32x4d”、“resnext101_32x8d”、“wide_resnet50_2”、“wide_resnet101_2”。For Model name, specify name of a certain ResNet structure and you can select from supported resnet: 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2'.

  3. 对于“预先训练”,指定是否使用在 ImageNet 上预先训练的模型。For Pretrained, specify whether to use a model pre-trained on ImageNet. 如果已选择,可以根据选定的预训练的模型来微调模型;如果取消选中,可以从头开始训练。If selected, you can fine-tune model based on selected pre-trained model; if deselected, you can train from scratch.

  4. 将 DenseNet 模块、训练和验证图像数据集模块的输出连接到训练 Pytorch 模型Connect the output of DenseNet module, training, and validation image dataset module to the Train Pytorch Model.

  5. 提交管道。Submit the pipeline.


管道运行完成后,若要使用模型进行评分,请将训练 Pytorch 模型连接到为图像模型评分,以预测新输入示例的值。After pipeline run is completed, to use the model for scoring, connect the Train Pytorch Model to Score Image Model, to predict values for new input examples.

技术说明Technical notes

模块参数Module parameters

名称Name 范围Range 类型Type 默认Default 说明Description
模型名称Model name 任意Any ModeMode resnext101_32x8dresnext101_32x8d 特定 ResNet 结构的名称Name of a certain ResNet structure
经过预先训练Pretrained 任意Any 布尔Boolean TrueTrue 是否使用在 ImageNet 上预先训练的模型Whether to use a model pre-trained on ImageNet


名称Name 类型Type 说明Description
未训练的模型Untrained model UntrainedModelDirectoryUntrainedModelDirectory 可连接到训练 Pytorch 模型的未训练的 ResNet 模型。An untrained ResNet model that can be connected to Train Pytorch Model.

后续步骤Next steps

请参阅 Azure 机器学习的可用模块集See the set of modules available to Azure Machine Learning.