Traceback (most recent call last):
File "/Users/charles/Documents/PY/OnnxOCR/main.py", line 15, in
result = model.ocr(img)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/onnx_paddleocr.py", line 35, in ocr
dt_boxes, rec_res = self.call(img, cls)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/predict_system.py", line 60, in call
rec_res = self.text_recognizer(img_crop_list)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/predict_rec.py", line 305, in call
outputs = self.rec_onnx_session.run(self.rec_output_name, input_feed=input_feed)
File "/Users/charles/Documents/PY/OnnxOCR/.venv/lib/python3.9/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 220, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: x for the following indices
index: 2 Got: 48 Expected: 32
Please fix either the inputs/outputs or the model.
1、在百度网盘下载好了这个100多兆的rec.onnx文件 2、然后放在了onnxocr/models/ch_ppocr_server_v2.0/rec文件夹下, 3、在utils.py文件的def infer_args():中修改了配置为: parser.add_argument("--det_model_dir", type=str, default='./onnxocr/models/ch_ppocr_server_v2.0/det/det.onnx') parser.add_argument("--rec_model_dir", type=str, default='./onnxocr/models/ch_ppocr_server_v2.0/rec/rec.onnx') parser.add_argument("--cls_model_dir", type=str, default='./onnxocr/models/ch_ppocr_server_v2.0/cls/cls.onnx') 这样修改以后,运行就报下边的错,把rec_model_dir这个参数改回原来的就不报错了,其他两项用ch_ppocr_server_v2.0的也没报错。
请问大神,这样配置是不是哪里有问题?需要怎么配置才能使用ch_ppocr_server_v2.0?另外问一下这两个模型有什么区别?谢谢啦!
Traceback (most recent call last): File "/Users/charles/Documents/PY/OnnxOCR/main.py", line 15, in
result = model.ocr(img)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/onnx_paddleocr.py", line 35, in ocr
dt_boxes, rec_res = self.call(img, cls)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/predict_system.py", line 60, in call
rec_res = self.text_recognizer(img_crop_list)
File "/Users/charles/Documents/PY/OnnxOCR/onnxocr/predict_rec.py", line 305, in call
outputs = self.rec_onnx_session.run(self.rec_output_name, input_feed=input_feed)
File "/Users/charles/Documents/PY/OnnxOCR/.venv/lib/python3.9/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 220, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: x for the following indices
index: 2 Got: 48 Expected: 32
Please fix either the inputs/outputs or the model.