dotnet / dotnet/machinelearning

How to feed a jpeg byte array to a ML.Net pipeline for predictions with ONNX model

Open
#5,946 0 comments 0 reactions 0 assignees View on GitHub
area-Vision question
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

### System information

- WIndows 10
- .NET framework 4.7 ML.NET 1.6:

### Feed a jpeg byte array for predictions

I am using a pretrained Keras from which I have coverted to ONNX for using in .NET enviroment. When I running inference in python both models Keras and ONNX are producing exact the same propabilities. When I running the ONNX model in .NET with Bitmap as input I am getting different results.
For the python models I am feeding the image from the .Net enviroment as a jpeg byte array. I would like to do the same in my ML.Net pipeline. I am trying to use the Transforms.ConvertToImage method but I cannot make to work.
I am getting the errors:
Schema mismatch for input column 'ImgInput': expected known-size vector of type Single, Double or Byte, got VarVector
If I fix the size "I getting Index was outside the bounds of the array"
Can you please let me know if there is a way of implementing this. Some examples ect.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.