How to apply simple thresholding on an image in ml.net?

Viewed 14

I haven't seen an implementation of simple thresholding in ml.net. This is how my pipeline looks like:

  var pipeline = mlContext.Transforms.LoadImages(outputColumnName: TinyYoloModelSettings.ModelInput, imageFolder: imagesFolder, inputColumnName: nameof(ImageNetData.ImagePath))
        .Append(mlContext.Transforms.ResizeImages(resizing: Microsoft.ML.Transforms.Image.ImageResizingEstimator.ResizingKind.IsoCrop,
                                                    outputColumnName: TinyYoloModelSettings.ModelInput,
                                                    imageWidth: ImageNetSettings.imageWidth,
                                                    imageHeight: ImageNetSettings.imageHeight,
                                                    inputColumnName: TinyYoloModelSettings.ModelInput))
        .Append(mlContext.Transforms.ConvertToGrayscale(outputColumnName: TinyYoloModelSettings.ModelInput))
        .Append(mlContext.Transforms.ExtractPixels(outputColumnName: TinyYoloModelSettings.ModelInput))
        .Append(mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation,
                        outputColumnNames: new[] { TinyYoloModelSettings.ModelOutput },
                        inputColumnNames: new[] { TinyYoloModelSettings.ModelInput }));

Ideally I would be able to add this after the ExtractPixels() call. I'm looking for a way to access the raw pixel values in the pipeline after that call but I'm not sure how to access that column's values

0 Answers
Related