ValueError (InvalidArgument) Broadcast dimension mismatch.
问题描述 / Problem Description
程序报错
运行环境 / Runtime Environment
- OS: windows 11
- Paddle: paddlepaddle-gpu 2.6.1
- PaddleOCR: paddleocr 2.8.1
- Python: 3.9.7
- CUDA 11.8
复现代码 / Reproduction Code
from paddleocr import PaddleOCR, draw_ocr
ocr = PaddleOCR(use_angle_cls=False, lang="ch")
img_path = r'C:\Users\xxxx\Pictures\Saved Pictures\插画.png'
result = ocr.ocr(img_path, cls=True)
for line in result:
print(line)
完整报错 / Complete Error Message
[20240723 185221] ppocr DEBUG Namespace(help='==SUPPRESS==', use_gpu=True, use_xpu=False, use_npu=False, use_mlu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='CUsersxxxx.paddleocrwhldetchch_PP-OCRv4_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='CUsersxxxx.paddleocrwhlrecchch_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='CUsersxxxxAppDataLocalProgramsPythonPython39libsite-packagespaddleocrppocrutilsppocr_keys_v1.txt', use_space_char=True, vis_font_path='.docfontssimfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='.ppocrutilsic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=False, cls_model_dir='CUsersxxxx.paddleocrwhlclsch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='.inference_results', save_crop_res=False, crop_res_save_dir='.output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='.log_output', show_log=True, use_onnx=False, return_word_box=False, output='.output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='..train_dataXFUNDclass_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='ch', det=True, rec=True, type='ocr', savefile=False, ocr_version='PP-OCRv4', structure_version='PP-StructureV2') [20240723 185224] ppocr WARNING Since the angle classifier is not initialized, it will not be used during the forward process [20240723 185225] ppocr DEBUG dt_boxes num 47, elapsed 0.3137333393096924 Traceback (most recent call last) File CUsersxxxxAppDataLocalProgramsPythonPython39libidlelibrun.py, line 559, in runcode exec(code, self.locals) File CUsersxxxxDesktoppy_homeocr_test.py, line 11, in module result = ocr.ocr(img_path, cls=True) File CUsersxxxxAppDataLocalProgramsPythonPython39libsite-packagespaddleocrpaddleocr.py, line 729, in ocr dt_boxes, rec_res, _ = self.call(img, cls, slice) File CUsersxxxxAppDataLocalProgramsPythonPython39libsite-packagespaddleocrtoolsinferpredict_system.py, line 144, in call rec_res, elapse = self.text_recognizer(img_crop_list) File CUsersxxxxAppDataLocalProgramsPythonPython39libsite-packagespaddleocrtoolsinferpredict_rec.py, line 677, in call self.predictor.run() ValueError (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [6, 96, 3, 20] and the shape of Y = [6, 96, 4, 20]. Received [3] in X is not equal to [4] in Y at i2. [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] = 10 != true1.] (at ..paddlephikernelsfuncscommon_shape.h86) [operator elementwise_add error]
可以提供一张图片吗,我们复现一下
可以提供一下你的识别模型吗?并且提供一下识别模型的下载地址
This issue is stale because it has been open for 90 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.