采用ddddocr训练的模型时数据类型报错!
6897889 opened this issue · comments
训练的模型,进行识别的时候数据类型报错!
代码如下:
`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))