Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

采用ddddocr训练的模型时数据类型报错! #2

Open
6897889 opened this issue Mar 21, 2022 · 0 comments
Open

采用ddddocr训练的模型时数据类型报错! #2

6897889 opened this issue Mar 21, 2022 · 0 comments

Comments

@6897889
Copy link

6897889 commented Mar 21, 2022

训练的模型,进行识别的时候数据类型报错!
代码如下:
`import ddddocr

ocr = ddddocr.DdddOcr()

ocr = ddddocr.DdddOcr(det=False, ocr=False, import_onnx_path="testocr_1.0_28_19000_2022-03-21-20-44-59.onnx", charsets_path="charsets.json")

with open("0CB7_1644684875.png", 'rb') as f:
image = f.read()

res = ocr.classification(image)
print(res)`

报错输出内容如下:

2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (tensor(double)) , expected: (tensor(float))

Traceback (most recent call last):
File "D:\python\ddddocr\1-验证码识别.py", line 10, in
res = ocr.classification(image)
File "C:\Program Files\Python39\lib\site-packages\ddddocr_init_.py", line 1629, in classification
ort_outs = self.__ort_session.run(None, ort_inputs)
File "C:\Users\GCB\AppData\Roaming\Python\Python39\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 195, 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: (tensor(double)) , expected: (tensor(float))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant