dotnet / dotnet/machinelearning
Replace ImagePixelExtractingEstimator values at runtime
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
**Is your feature request related to a problem? Please describe.**
I am using orderOfExtraction: ImagePixelExtractingEstimator.ColorsOrder for ONNX pipeline. However, I need to select exact values for this attribute like:: orderOfExtraction: ImagePixelExtractingEstimator.ColorsOrder.ARBG. There are 6 options to select from (ARGB, ARBG, ABRG, ABGR, AGRB, AGBR). Instead of hardcoding these attribute values I need to pass a variable at runtime for these.
**Describe the solution you'd like**
For ONNX orderOfExtraction: ImagePixelExtractingEstimator.ColorsOrder.ARBG, there are 6 options to select from (ARGB, ARBG, ABRG, ABGR, AGRB, AGBR). Instead of hardcoding these attribute values I need to pass a variable at runtime for these.
**Describe alternatives you've considered**
I tried to replace this value as variable, but I am not sure how can I use variable in place of this attribute value.
**Additional context**
var pipeline = mlContext.Transforms.ResizeImages(resizing: ImageResizingEstimator.ResizingKind.Fill, outputColumnName: "data", imageWidth: ImageSettings.imageWidth, imageHeight: ImageSettings.imageHeight, inputColumnName: nameof(ImageInput.Image))
.Append(mlContext.Transforms.ExtractPixels(outputColumnName: "data", orderOfExtraction: ImagePixelExtractingEstimator.ColorsOrder.AGRB))
.Append(mlContext.Transforms.ApplyOnnxModel(modelFile: modeltoInfer.ModelPath, outputColumnName: "model_outputs0", inputColumnName: "data", gpuDeviceId: gpuDeviceId, fallbackToCpu: fallbackToCpu));
Contributor guide
Assessment
This issue has not been assessed yet.