loadImage: Transformasi Gambar Beban Pembelajaran Mesin
Memuat data gambar.
Penggunaan
loadImage(vars)
Argumen
vars
Daftar vektor karakter bernama dari nama variabel input dan nama variabel output. Perhatikan bahwa variabel input harus berjenis yang sama. Untuk pemetaan satu-ke-satu antara variabel input dan output, vektor karakter bernama dapat digunakan.
Detail
loadImage
memuat gambar dari jalur.
Nilai
Objek maml
yang menentukan transformasi.
Penulis
Microsoft Corporation Microsoft Technical Support
Contoh
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")