machinelearning icon indicating copy to clipboard operation
machinelearning copied to clipboard

ML.Net incorrect results with ONNX model

Open crazyoutlook opened this issue 3 years ago • 3 comments

System information

  • OS version/distro: Windows 10/11
  • .NET Version (eg., dotnet --info): Dot Net versions 2.1/5/6 ML.Net_Onnx.zip

Issue

  • What did you do? I created a object detection model in Azure Custom Vision then exported it as ONNX and tried consuming it with ML.Net. I am using following ML package versions : Microsoft.ML (1.4.0), Microsoft.ML.ImageAnalytics (1.4.0). Microsoft.ML.OnnxTransformer (1.4.0)

  • What happened? ML.Net with ONNX model is giving me incorrect prediction results or no results or very poor confidence levels.

  • What did you expect? I am expecting correct results when working with ONNX model and ML.Net. To re-confirm the issue I consumed same ONNX model with Python code and it worked correct and prediction results were as expected. So there does not seem to be any issue with ONNX model file. The issue seems to be with ML.Net code in the way predictions are done

Source code / logs

I am attaching ML.Net source code which I am using to consume ONNX model

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

crazyoutlook avatar Sep 13 '22 07:09 crazyoutlook

I also tested this issue with ML package versions : Microsoft.ML (1.7.1), Microsoft.ML.ImageAnalytics (1.7.1). Microsoft.ML.OnnxTransformer (1.7.1) but issue still exists.

crazyoutlook avatar Sep 13 '22 07:09 crazyoutlook

python-code.zip

Uploaded Python code which is giving correct result with ONNX model

crazyoutlook avatar Sep 13 '22 08:09 crazyoutlook

Hi Team, Can you please have a look at this ticket, this is related to a production issue.

crazyoutlook avatar Sep 15 '22 04:09 crazyoutlook

@crazyoutlook sorry for my delay. I'll take a look at it and get back to you shortly.

michaelgsharp avatar Oct 10 '22 19:10 michaelgsharp

Hi Michael, Thank you for response. We can close this issue. I was able to resolve this by using ImagePixelExtractingEstimator of ML.Net pipeline.

crazyoutlook avatar Oct 12 '22 05:10 crazyoutlook