Data type error
Open
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 9.8k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
In the pre-processing sample code snippet:
# input
image_data = preprocess(image)
image_size = np.array([image.size[1], image.size[0]], dtype=np.int32).reshape(1, 2)
image size variable type is set to int32 as:
image_size = np.array([image.size[1], image.size[0]], **dtype=np.int32**).reshape(1, 2)
But tiny Yolo V3 model's input data types are float32. Above (current sample) code gives following error:
boxes, scores, indices = session.run(None, {"input_1": imgData, "image_shape":imgSize})
File "/opt/miniconda/lib/python3.7/site-packages/onnxruntime/capi/session.py", line 142, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (N11onnxruntime17PrimitiveDataTypeIiEE) , expected: (N11onnxruntime17PrimitiveDataTypeIfEE)
Correct sample code should be:
# input
image_data = preprocess(image)
image_size = np.array([image.size[1], image.size[0]], dtype=np.float32).reshape(1, 2)
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 from the pre-processing sample code shown in the issue and check the dtype used for image_size before the session.run call. Update the sample so its input type matches the model, then run the tiny YOLO V3 inference sample and confirm the input data type error no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100