PaddleOCR
PaddleOCR copied to clipboard
ValueError: (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [3, 1152, 64] and the shape of Y = [1, 960, 64]. Received [1152] in X is not equal to [960] in Y at i:1. [Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at ../paddle/phi/kernels/funcs/common_shape.h:86) [operator < elementwise_add > error]
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
-
系统环境/System Environment:centos7
-
版本号/Version:Paddle:paddlepaddle-gpu 2.5.2.post112
PaddleOCR:2.7.0.3 问题相关组件/Related components: -
运行指令/Command Code: ocr = PaddleOCR(use_angle_cls=False, lang="ch", det_model_dir = det_model_dir, rec_model_dir = rec_model_dir, cls_model_dir = None, det_db_thresh=0.3, det_db_box_thresh=0.6 ) det_model_dir为训练的mv3db模型 rec_model_dir为训练的rec_svtrnet_ch模型 使用ch_PP-OCRv4_rec识别模型不会报错,调整了rec_svtrnet_ch.yml中的尺寸[3,32,320]为[3,48,320]重新训练模型也不能解决问题 似乎对于不同的输入图片,已有代码不能自动处理成合适的大小供rec_svtrnet_ch模型推理.
-
完整报错/Complete Error Message: Traceback (most recent call last): File "/data/anaconda3/envs/paddleocr27/lib/python3.8/pdb.py", line 1705, in main pdb._runscript(mainpyfile) File "/data/anaconda3/envs/paddleocr27/lib/python3.8/pdb.py", line 1573, in _runscript self.run(statement) File "/data/anaconda3/envs/paddleocr27/lib/python3.8/bdb.py", line 580, in run exec(cmd, globals, locals) File "
", line 1, in File "/data2/Liuyu/PaddleOCR_v2.7/infer_exam.py", line 70, in result = ocr.ocr(img_path, cls=True, rec=True) File "/data2/Liuyu/PaddleOCR_v2.7/paddleocr.py", line 676, in ocr dt_boxes, rec_res, _ = self.call(img, cls) File "/data2/Liuyu/PaddleOCR_v2.7/tools/infer/predict_system.py", line 106, in call rec_res, elapse = self.text_recognizer(img_crop_list) File "/data2/Liuyu/PaddleOCR_v2.7/tools/infer/predict_rec.py", line 616, in call self.input_tensor.copy_from_cpu(norm_img_batch) ValueError: (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [3, 1152, 64] and the shape of Y = [1, 960, 64]. Received [1152] in X is not equal to [960] in Y at i:1. [Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at ../paddle/phi/kernels/funcs/common_shape.h:86) [operator < elementwise_add > error] Uncaught exception. Entering post mortem debugging
我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no):
请尽量不要包含图片在问题中/Please try to not include the image in the issue.