microsoft / microsoft/onnxruntime-inference-examples

invalid protobuf error running mnist sample

Open
#17 5 comments 0 reactions 1 assignee View on GitHub

@snnn is already working on this.

Since Mar 12, 2021.

Dominant language
C++
Stars
1.7k
Forks
414
Avg merge
1d 6h
Merged PRs (30d)
14

Description

Describe the bug
I built the onnxruntime and the samples according to the instructions. I copied the necessary dlls (libpng16.dll and onnxruntime.dll) into the output folder with mnist.exe. I downloaded the onnx model database here: https://github.com/onnx/models and copied the mnist-8.onnx model as 'model.onnx' into the solution director so I could step through the code with the debugger. When constructing the Ort::Session object, I get the error: "Load model from model.onnx failed:Protobuf parsing failed." and the constructor throws and the program returns 0.

Urgency
Not urgent

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: latest as of today (9 March 2021) I just cloned this repo
  • Python version: n/a
  • Visual Studio version (if applicable): 2019
  • GCC/Compiler version (if compiling from source): MSVC 142, SDK 10.0.183623.0
  • CUDA/cuDNN version: n/a
  • GPU model and memory: n/a

To Reproduce

  • clone this repo
  • run build.bat targeting RelWithDebInfo for visual studio 2019:

.\build.bat --config RelWithDebInfo --build_shared_lib --parallel --cmake_generator "Visual Studio 16 2019"

  • 0 warnings, 0 errors, 0 of 6 tests failed
  • install into default directory (C:\Program Filess (x86)\onnxruntime) by running build on INSTALL in visual studio in admin mode
  • cd into samples\c_cxx and run the following commands:

mkdir build
cd build
cmake .. -A x64 -T host=x64 -DLIBPNG_ROOTDIR=<path\to\libpng>

  • open samples.sln in visual studio

  • build mnist

  • manually copy onnxruntime.dll and libpng16.dll into output folder (<path\to\c_cxx\build\MNIST\Debug>)

  • clone https://github.com/onnx/models

  • copy https://github.com/onnx/models/blob/master/vision/classification/mnist/model/mnist-8.onnx as model.onnx into the mnist sample SolutionDir (<path\to\c_cxx\build\MNIST>)

  • set mnist project as startup project in visual studio

  • start debugger

  • Attach the ONNX model to the issue (where applicable) to expedite investigation.

  • Tried to attach! Github wouldn't let me attach the onnx filetype, but the link is above.

Expected behavior
I expected the model to load properly and the program to run.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.