Share via


extractPixels: 기계 학습 픽셀 데이터 추출 변환

이미지에서 픽셀 값을 추출합니다.

사용

  extractPixels(vars, useAlpha = FALSE, useRed = TRUE, useGreen = TRUE,
    useBlue = TRUE, interleaveARGB = FALSE, convert = TRUE, offset = NULL,
    scale = NULL)

인수

vars

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

useAlpha

알파 채널을 사용할지 여부를 지정합니다. 기본값은 FALSE입니다.

useRed

빨간색 채널을 사용할지 여부를 지정합니다. 기본값은 TRUE입니다.

useGreen

녹색 채널을 사용할지 여부를 지정합니다. 기본값은 TRUE입니다.

useBlue

파란색 채널을 사용할지 여부를 지정합니다. 기본값은 TRUE입니다.

interleaveARGB

각 채널이나 인터리브를 ARGB 순서로 구분할지 여부입니다. 예를 들어 합성곱 신경망을 학습시키는 경우 커널, stride 등의 모양에 영향을 주기 때문에 중요할 수 있습니다.

convert

부동 소수점으로 변환할지 여부입니다. 기본값은 FALSE입니다.

offset

오프셋(프리스케일)을 지정합니다. convert = TRUE여야 합니다. 기본값은 NULL입니다.

scale

배율을 지정합니다. convert = TRUE여야 합니다. 기본값은 NULL입니다.

세부 정보

extractPixels는 이미지에서 픽셀 값을 추출합니다. 입력 변수는 크기가 같은 이미지이며, 일반적으로 resizeImage 변환의 출력입니다. 출력은 일반적으로 학습자에 대한 기능으로 사용되는 벡터 형식의 픽셀 데이터입니다.

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