onnx Error parsing message with type 'onnx.ModelProto'
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 9.8k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Bug Report
Which model does this pertain to?
resnet50-v2-7.onnx
bvlcalexnet-3.onnx
googlenet-9.onnx
vgg16-7.onnx
Describe the bug
when I run the python script load onnx model , it get error as
google.protobuf.message.DecodeError: Error parsing message with type 'onnx.ModelProto'

how to solve the problem ?
Reproduction instructions
System Information
OS Platform and Distribution (e.g. Linux Ubuntu 16.04):
Ubuntu18.04
ONNX version (e.g. 1.6):
onnx 1.12.0
Backend/Runtime version (e.g. ONNX Runtime 1.1, PyTorch 1.2):
Provide a code snippet to reproduce your errors.
import onnx
import numpy as np
MODEL_NAME = "ResNet-50" # "AlexNet" or "ResNet-50" or "GoogleNet" or "Vgg-16"
if MODEL_NAME == "AlexNet":
MODEL_PATH = 'onnx-model/vision/classification/alexnet/model/bvlcalexnet-3.onnx'
INPUT_NAME = "data_0"
elif MODEL_NAME == "ResNet-50":
MODEL_PATH = 'onnx-model/vision/classification/resnet/model/resnet50-v2-7.onnx'
INPUT_NAME = "data"
elif MODEL_NAME == "GoogleNet":
MODEL_PATH = 'onnx-model/vision/classification/inception_and_googlenet/googlenet/model/googlenet-9.onnx'
INPUT_NAME = "data_0"
elif MODEL_NAME == "Vgg-16":
MODEL_PATH = 'onnx-model/vision/classification/vgg/model/vgg16-7.onnx'
INPUT_NAME = "data"
elif MODEL_NAME == "Vgg-19":
MODEL_PATH = 'onnx-model/vision/classification/vgg/model/vgg19-7.onnx'
INPUT_NAME = "data"
dtype="float32"
batch, channel, height, weight = 1, 3, 224, 224
I_np = np.random.uniform(size=(batch, channel, height, weight)).astype(dtype)
onnx_model = onnx.load(MODEL_PATH)
shape_dict = {INPUT_NAME: I_np.shape}
Notes
Any additional information
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Python reproduction and the four model paths under onnx-model/vision/classification. Run onnx.load for resnet50-v2-7.onnx, bvlcalexnet-3.onnx, googlenet-9.onnx, and vgg16-7.onnx in the stated Ubuntu and ONNX 1.12.0 environment. Done means identifying why parsing fails and documenting or validating a reproducible fix for loading the affected models.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100