How to add custom normalize image data by MlContext.Transform ?

Hoang Dung 0 Reputation points
2024-01-17T15:49:42.86+00:00

i have flow preprocess data in python like this : img -= (104, 117, 123) (RGB image) I want to do this with MlContext.Transform because i haved this : MLContext mlContext = new MLContext();

var pipeline = mlContext.Transforms.LoadImages(outputColumnName: "input0", imageFolder: "", inputColumnName: nameof(ImageNetData.ImagePath)) .Append(mlContext.Transforms.ResizeImages(outputColumnName: "input0", imageWidth: ImageNetSettings.imageWidth, imageHeight: ImageNetSettings.imageHeight, inputColumnName: "input0")) .Append(mlContext.Transforms.ExtractPixels(outputColumnName: "input0")) .Append(mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation, outputColumnNames: new[] { TinyYoloModelSettings.ModelOutputConf, TinyYoloModelSettings.ModelOutputBox, TinyYoloModelSettings.ModelOutputLandmark }, inputColumnNames: new[] { TinyYoloModelSettings.ModelInput })); How can i implement this custom normalize after Resize ???. Thank for your help.

.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
150 questions
0 comments No comments
{count} votes