You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an image classification model that was created in python. I am trying to load the onnx model in c#, but am running into errors. The image data the model was created on was 4 channel 256x256 images. When loading the model, the shape is correct, but the data length seems to be only 3 channel rgb instead of rgba (i.e. 256x256x3 = 196608). Here is the error:
System.InvalidOperationException: 'Input shape mismatch: Input 'sequential_input' has shape 1,256,256,4, but input data is of length 196608.'
Here is the code for loading the model:
var pipeline = mlContext.Transforms
.ResizeImages("image", 256, 256, inputColumnName: "sequential_input")
.Append(mlContext.Transforms.ExtractPixels("sequential_input", "image"))
.Append(mlContext.Transforms.ApplyOnnxModel("dense_1", "sequential_input", ONNX_MODEL_PATH, gpuDeviceId: 0));
var emptyDv = mlContext.Data.LoadFromEnumerable(new OnnxInput[] { });
var model = pipeline.Fit(emptyDv);
return model;
To reproduce
Create an image classification model with 4 channels and try to load the onnx model.
Urgency
Soon
Platform
Windows
OS Version
11
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
2.0.1
ONNX Runtime API
C#
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
11.8
The text was updated successfully, but these errors were encountered:
Describe the issue
I have an image classification model that was created in python. I am trying to load the onnx model in c#, but am running into errors. The image data the model was created on was 4 channel 256x256 images. When loading the model, the shape is correct, but the data length seems to be only 3 channel rgb instead of rgba (i.e. 256x256x3 = 196608). Here is the error:
Here is the code for loading the model:
To reproduce
Create an image classification model with 4 channels and try to load the onnx model.
Urgency
Soon
Platform
Windows
OS Version
11
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
2.0.1
ONNX Runtime API
C#
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
11.8
The text was updated successfully, but these errors were encountered: