我有一个模型可以接受尺寸为64x64x1的输入图像,但是在ML.NET中,我只能选择R或G或B通道或全部通道,它们生成64x64x3之类的输入,是否有任何发送方式一个通道图像像灰度?考虑到我正在使用位图,例如来自文档的示例。方法ConvertToGrayScale无法解决我的问题,因为它仍会生成3通道输出
var pipeline = mlContext.Transforms.ResizeImages(resizing: ImageResizingEstimator.ResizingKind.Fill, outputColumnName: onnxModel.ModelInput, imageWidth: ImageSettings.imageWidth, imageHeight: ImageSettings.imageHeight, inputColumnName: nameof(ImageInputData.Image))
.Append(mlContext.Transforms.ExtractPixels(outputColumnName: onnxModel.ModelInput, inputColumnName: onnxModel.ModelInput, interleavePixelColors: true, colorsToExtract: ImagePixelExtractingEstimator.ColorBits.Red))
.Append(mlContext.Transforms.ApplyOnnxModel(modelFile: onnxModel.ModelPath, outputColumnName: onnxModel.ModelOutput, inputColumnName: onnxModel.ModelInput));