onnxruntime Error BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

-1

I made a LOBE model as onnx. Then I used the sample code in the main page but it shows me an error on runtime:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'Microsoft.ML.OnnxRuntime.**NativeMethods**' threw an exception.
Source=Microsoft.ML.OnnxRuntime
StackTrace:
at Microsoft.ML.OnnxRuntime.SessionOptions..ctor() in C:\a\3\s\csharp\src\Microsoft.ML.OnnxRuntime\SessionOptions.cs:line 50
at lobe.OnnxImageClassifier.InitialiseFromSignature(Signature signature, String modelFileName)
at lobe.ImageClassifier.CreateFromSignature(Signature signature, String modelFileName, String engineType)
at lobe.ImageClassifier.CreateFromSignatureFile(FileInfo signatureFile, String modelFileName, String format)
at AIWebApp.ML.LobeOfficeAppDetection.Main(String signatureFilePath, String imageToClassify) in G:***\LobeDetection.cs:line 26 at .Tests.MyTests.Test1() in G:\MyTests.cs:line 21

Inner Exception 1:
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

I think this is where the exception is thrown: https://github.com/microsoft/onnxruntime/blob/eab164e1a5cd7760ee653ffe455e7a10cded7cb2/csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs#L693

How can I solve the problem?

I'm using:

  • Windows 7 64Bit
  • VS 2017 (15.9.18) Framework 4.7.1

This is my expected result.

c#
classification
onnx
onnxruntime
microsoft.ml
asked on Stack Overflow Jan 16, 2021 by mohamamd • edited Jan 16, 2021 by mkrieger1

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0