[ONNXRuntimeError] Arcface model fails during ONNX runtime session run
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 9.8k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Symptom
Arcface model from onnx model zoo doesn't run properly in ONNX runtime session run (tested in 1.0.0).
The following error message gets printed out:
2019-11-20 17:24:29.510729 [E:onnxruntime:, sequential_executor.cc:165 Execute] Non-zero status code returned while running BatchNormalization node. Name:'stage1_unit1_bn1' Status Message: Invalid input scale: NumDimensions() != 3
Traceback (most recent call last):
File "test.py", line 21, in <module>
ort_sess.run(None, ort_data)
File "/Users/moreau/.pyenv/versions/3.7.0/lib/python3.7/site-packages/onnxruntime/capi/session.py", line 136, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running BatchNormalization node. Name:'stage1_unit1_bn1' Status Message: Invalid input scale: NumDimensions() != 3
Reproducing the error
Environment:
- ubuntu: 18.04
- python: 3.7.0
- onnx: 1.6.0
- onnxruntime: 1.0.0
- numpy: 1.17.4
Dockerfile to reproduce error:
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y python3-dev python3-pip git vim
RUN pip3 install --upgrade pip
RUN pip3 install numpy==1.17.4
RUN pip3 install onnx==1.6.0
RUN pip3 install onnxruntime==1.0.0
Model:
- URL: https://s3.amazonaws.com/onnx-model-zoo/arcface/resnet100/resnet100.onnx
- SHA: 66074b860f905295aab5a842be57f37d
Minimal python script:
import numpy as np
import urllib.request
import onnxruntime
import os
MODEL_FILE = "resnet100.onnx"
URL = "https://s3.amazonaws.com/onnx-model-zoo/arcface/resnet100/resnet100.onnx"
# Download model file
if not os.path.exists(MODEL_FILE):
urllib.request.urlretrieve(URL, MODEL_FILE)
# Create ONNX runtime session
ort_sess = onnxruntime.InferenceSession(MODEL_FILE)
# Print information on model input
for idx, inp in enumerate(ort_sess.get_inputs()):
print("Input info: {}".format(inp))
# Init data
ort_data = {"data": np.random.rand(1,3,112,112).astype("float32")}
# Run
ort_sess.run(None, ort_data)
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 test.py reproduction and Dockerfile, then inspect the Arcface resnet100.onnx model at the onnxruntime.InferenceSession and run entry points. Compare the stage1_unit1_bn1 BatchNormalization node with the reported runtime error and verify the result by rerunning the minimal script; done means the model session runs without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100