jingsongliujing / OnnxOCR

基于PaddleOCR重构,并且脱离PaddlePaddle深度学习训练框架的轻量级OCR,推理速度超快
Apache License 2.0
730 stars 71 forks source link

使用ch_ppocr_server_v2.0这个模型,报错了 #24

Open CcgKaneki opened 3 months ago

CcgKaneki commented 3 months ago

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.

jingsongliujing commented 3 months ago

2.0版本切到master分支 image