onnx Error parsing message with type 'onnx.ModelProto'
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
Hi @wangzy0327, Have you git-lfs theses models before using them? See https://github.com/onnx/models#usage---git-lfs-. They were initially stored as a git-lfs so you will need to further git-lfs them after git clone.
OK,Thanks for your solution.
How did you solve this problem in the end?