featurizeImage: Machine Learning による画像の特徴付け変換

事前トレーニング済みのディープ ニューラル ネットワークモデルを使用して、画像を特徴化します。

使用方法

  featurizeImage(var, outVar = NULL, dnnModel = "Resnet18")

引数

var

抽出されたピクセル値を含む入力変数。

outVar

画像の特徴を含む出力変数のプレフィックス。 null の場合は、入力変数名が使用されます。 既定値は NULL です。

dnnModel

事前トレーニング済みのディープ ニューラル ネットワーク。 オプションは次のとおりです。

説明

featurizeImage では、指定された事前トレーニング済みのディープ ニューラル ネットワーク モデルを使用して、画像を特徴化します。 この変換に対する入力変数は、ピクセル値を抽出する必要があります。

変換を定義する maml オブジェクト。

作成者

Microsoft Corporation Microsoft Technical Support


 train <- data.frame(Path = c(system.file("help/figures/RevolutionAnalyticslogo.png", package = "MicrosoftML")), Label = c(TRUE), stringsAsFactors = FALSE)

 # Loads the images from variable Path, resizes the images to 1x1 pixels and trains a neural net.
 model <- rxNeuralNet(
     Label ~ Features,
     data = train,
     mlTransforms = list(
         loadImage(vars = list(Features = "Path")),
         resizeImage(vars = "Features", width = 1, height = 1, resizing = "Aniso"),
         extractPixels(vars = "Features")
         ),
     mlTransformVars = "Path",
     numHiddenNodes = 1,
     numIterations = 1)

 # Featurizes the images from variable Path using the default model, and trains a linear model on the result.
 model <- rxFastLinear(
     Label ~ Features,
     data = train,
     mlTransforms = list(
         loadImage(vars = list(Features = "Path")),
         resizeImage(vars = "Features", width = 224, height = 224), # If dnnModel == "AlexNet", the image has to be resized to 227x227.
         extractPixels(vars = "Features"),
         featurizeImage(var = "Features")
         ),
     mlTransformVars = "Path")