应用图像转换Apply Image Transformation

本文介绍如何使用 Azure 机器学习设计器中的“应用图像转换”模块,根据先前指定的图像转换修改输入图像目录。This article describes how to use the Apply Image Transformation module in Azure Machine Learning designer, to modify an input image directory based on a previously specified image transformation.

需要连接 初始化图像转换模块来指定转换,然后可以将此类转换应用于“应用图像转换”模块的输入图像目录。You need to connect an Init Image Transformation module to specify the transformation, and then you can apply such transformation to the input image directory of the Apply Image Transformation module.

如何使用“应用图像转换”How to use Apply Image Transformation

  1. 将“应用图像转换”模块添加到管道。Add the Apply Image Transformation module to your pipeline. 可以在“计算机视觉/图像数据转换”类别下找到此模块。You can find this module under Computer Vision/Image Data Transformation category.

  2. 将“初始化图像转换”的输出连接到“应用图像转换”的左侧输入。Connect the output of Init Image Transformation to the left-hand input of Apply Image Transformation .

    备注

    此模块仅接受 初始化图像转换模块生成的图像转换。Only image transformation generated by Init Image Transformation module is accepted to this module. 对于其他类型的转换,请将其连接到 应用转换,否则会引发“InvalidTransformationDirectoryError”。For other kind of transformation, please connect it to Apply Transformation, otherwise 'InvalidTransformationDirectoryError' will be thrown.

  3. 连接要转换的图像目录。Connect the image directory that you want to transform.

  4. 对于“模式”,请指定你使用输入转换的目的:“用于训练”或“用于推理”。For Mode , specify for what purpose you use input transformation: 'For training' or 'For inference'.

    如果选择“用于训练”,则会应用你在“初始化图像转换”中指定的所有转换。If you select For training , all transformation you specify in Init Image Transformation will be applied.

    如果选择“用于推理”,则会在应用之前排除“随机创建新样本”这样的转换。If you select For inference , transformation like creating new samples randomly will be excluded before being applied. 这是因为在训练过程中,随机创建新样本的转换操作(如“随机水平翻转”)用于数据补充,而在推理过程中,由于需要修复推理样本以进行准确的预测和评估,则应将此类转换删除。This is because transformation operations to create new samples randomly like 'Random horizontal flip' are used for data augmentation in training, which should be removed in inference because inference samples need to be fixed for accurate prediction and evaluation.

    备注

    将在 用于推理 模式中排除的转换为:随机重设裁剪大小、随机裁剪、随机水平翻转、随机垂直翻转、随机旋转、随机仿射、随机灰度、随机透视、随机擦除。Transformations which will be excluded in mode For inference are: Random resized crop, Random crop, Random horizontal flip, Random vertical flip, Random rotation, Random affine, Random grayscale, Random perspective, Random erasing.

  5. 若要将图像转换应用于新的图像目录,请提交管道。To apply a image transformation to a new image directory, submit the pipeline.

模块参数Module parameters

名称Name 范围Range 类型Type 默认Default 说明Description
ModeMode 任意Any ModeMode (要求用户指定)(Require user to specify) 出于什么目的使用输入转换。For what purpose you use input transformation. 应在推理中排除“随机”转换操作,但在训练中保留这些操作You should exclude 'Random' transform operations in inference but keep them in training

预期输入Expected inputs

名称Name 类型Type 说明Description
输入图像转换Input image transformation 转换目录Transformation Directory 输入图像转换Input image transformation
输入图像目录Input image directory 图像目录Image Directory 要转换的图像目录Image directory to be transformed

OutputsOutputs

名称Name 类型Type 说明Description
输出图像目录Output image directory 图像目录Image Directory 输出图像目录Output image directory

后续步骤Next steps

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