loadImage: 기계 학습 이미지 로드 변환

이미지 데이터를 로드합니다.

사용

  loadImage(vars)

인수

vars

입력 변수 이름의 명명된 문자 벡터 목록 및 출력 변수의 이름입니다. 입력 변수는 동일한 형식이어야 합니다. 입력 변수와 출력 변수 간 일대일 매핑의 경우 명명된 문자 벡터를 사용할 수 있습니다.

세부 정보

loadImage는 경로에서 이미지를 로드합니다.

변환을 정의하는 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")