Closed VinuthaRaghavendra closed 4 years ago
Hi @VinuthaRaghavendra ,
Thank you for your question. I think this is more of a product question and would suggest raising an issue on the dotnet/machinelearning.
In general, you can take a look at this sample which scores using an ONNX model and normalizes the images beforehand.
Sample
ML.NET Pipeline
Normalization Custom Transform: https://github.com/dotnet/machinelearning-samples/blob/master/samples/modelbuilder/ImageClassification_Azure_LandUse/LandUseML.Model/NormalizeMapping.cs
Hi, I have trained tinyyolo in tensorflow and converted to .onnx using tf2onnx.
I have trained grayscaled 3 channeled image having offset 32, normalization (0-1). Tried the onnxruntime inference in python and predictions are exact. But predictions using winmltools in ml.net results condifence score always equal to 99 (pixels are incorrect)
using var pipeline = mlContext.Transforms.ResizeImages(outputColumnName: onnxModel.ModelInput,imageWidth: ImageSettings.imageWidth, imageHeight: ImageSettings.imageHeight,inputColumnName: nameof(ImageInputData.Image)) .Append(mlContext.Transforms.ExtractPixels(outputColumnName: onnxModel.ModelInput, offsetImage: 32f,scaleImage: 1/255f)) .Append(mlContext.Transforms.ApplyOnnxModel(modelFile: onnxModel.ModelPath, outputColumnName: onnxModel.ModelOutput, inputColumnName: onnxModel.ModelInput))
Can you please suggest the solution to preprocess image using onnx to have correct predictions