首页 Paddle框架 帖子详情
paddleOCR推理报错Broadcast dimension mismatch
收藏
快速回复
Paddle框架 问答深度学习模型训练 484 2
paddleOCR推理报错Broadcast dimension mismatch
收藏
快速回复
Paddle框架 问答深度学习模型训练 484 2

Linux上使用paddleocr --image_dir /home/zzh/imgs/1.jpg --use_angle_cls true --use_gpu true进行推理,结果

[2023/07/18 14:03:41] ppocr DEBUG: Namespace(alpha=1.0, benchmark=False, beta=1.0, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir='/home/zzh/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_thresh=0.9, cpu_threads=10, crop_res_save_dir='./output', det=True, det_algorithm='DB', det_box_type='quad', det_db_box_thresh=0.6, det_db_score_mode='fast', det_db_thresh=0.3, det_db_unclip_ratio=1.5, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_east_score_thresh=0.8, det_limit_side_len=960, det_limit_type='max', det_model_dir='/home/zzh/.paddleocr/whl/det/ch/ch_PP-OCRv3_det_infer', det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, det_pse_thresh=0, det_sast_nms_thresh=0.2, det_sast_score_thresh=0.5, draw_img_save_dir='./inference_results', drop_score=0.5, e2e_algorithm='PGNet', e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_limit_side_len=768, e2e_limit_type='max', e2e_model_dir=None, e2e_pgnet_mode='fast', e2e_pgnet_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, fourier_degree=5, gpu_mem=500, help='==SUPPRESS==', image_dir='/home/zzh/imgs/1.jpg', image_orientation=False, ir_optim=True, kie_algorithm='LayoutXLM', label_list=['0', '180'], lang='ch', layout=True, layout_dict_path=None, layout_model_dir=None, layout_nms_threshold=0.5, layout_score_threshold=0.5, max_batch_size=10, max_text_length=25, merge_no_span_structure=True, min_subgraph_size=15, mode='structure', ocr=True, ocr_order_method=None, ocr_version='PP-OCRv3', output='./output', page_num=0, precision='fp32', process_id=0, re_model_dir=None, rec=True, rec_algorithm='SVTR_LCNet', rec_batch_num=6, rec_char_dict_path='/home/zzh/miniconda3/envs/ndsl_ocr/lib/python3.8/site-packages/paddleocr/ppocr/utils/ppocr_keys_v1.txt', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_model_dir='/home/zzh/.paddleocr/whl/rec/ch/ch_PP-OCRv3_rec_infer', recovery=False, save_crop_res=False, save_log_path='./log_output/', scales=[8, 16, 32], ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ser_model_dir=None, show_log=True, sr_batch_num=1, sr_image_shape='3, 32, 128', sr_model_dir=None, structure_version='PP-StructureV2', table=True, table_algorithm='TableAttn', table_char_dict_path=None, table_max_len=488, table_model_dir=None, total_process_num=1, type='ocr', use_angle_cls=True, use_dilation=False, use_gpu=True, use_mp=False, use_npu=False, use_onnx=False, use_pdf2docx_api=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, use_visual_backbone=True, use_xpu=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=False)
[2023/07/18 14:03:44] ppocr INFO: **********/home/zzh/imgs/1.jpg**********
[2023/07/18 14:03:45] ppocr DEBUG: dt_boxes num : 2, elapse : 0.5565781593322754
[2023/07/18 14:03:45] ppocr DEBUG: cls num : 2, elapse : 0.04004931449890137
Traceback (most recent call last):
File "/home/zzh/miniconda3/envs/ndsl_ocr/bin/paddleocr", line 8, in
sys.exit(main())
File "/home/zzh/miniconda3/envs/ndsl_ocr/lib/python3.8/site-packages/paddleocr/paddleocr.py", line 687, in main
result = engine.ocr(img_path,
File "/home/zzh/miniconda3/envs/ndsl_ocr/lib/python3.8/site-packages/paddleocr/paddleocr.py", line 566, in ocr
dt_boxes, rec_res, _ = self.__call__(img, cls)
File "/home/zzh/miniconda3/envs/ndsl_ocr/lib/python3.8/site-packages/paddleocr/tools/infer/predict_system.py", line 95, in __call__
rec_res, elapse = self.text_recognizer(img_crop_list)
File "/home/zzh/miniconda3/envs/ndsl_ocr/lib/python3.8/site-packages/paddleocr/tools/infer/predict_rec.py", line 609, in __call__
self.predictor.run()
ValueError: In user code:

File "tools/export_model.py", line 172, in
main()
File "tools/export_model.py", line 165, in main
sub_model_save_path, logger)
File "tools/export_model.py", line 99, in export_single_model
paddle.jit.save(model, save_path)
File "", line 2, in save

File "/usr/local/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 744, in save
inner_input_spec)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 517, in concrete_program_specify_input_spec
*desired_input_spec)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 427, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 723, in __getitem__
self._caches[item] = self._build_once(item)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 714, in _build_once
**cache_key.kwargs)
File "", line 2, in from_func_spec

File "/usr/local/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 662, in from_func_spec
outputs = static_func(*inputs)
File "/tmp/tmpmmf1gn4e.py", line 29, in forward
false_fn_1, (x,), (x,), (x,))
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 211, in convert_ifelse
out = _run_py_ifelse(pred, true_fn, false_fn, true_args, false_args)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 257, in _run_py_ifelse
return true_fn(*true_args) if pred else false_fn(*false_args)
File "/paddle/debug/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 82, in forward
x = self.neck(x)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in __call__
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/paddle/debug/PaddleOCR/ppocr/modeling/necks/db_fpn.py", line 247, in forward
in5, scale_factor=2, mode="nearest", align_mode=1) # 1/16
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/layers/math_op_patch.py", line 347, in __impl__
attrs={'axis': axis})
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 3184, in append_op
attrs=kwargs.get("attrs", None))
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2224, in __init__
for frame in traceback.extract_stack():

InvalidArgumentError: Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [2, 96, 3, 45] and the shape of Y = [2, 96, 4, 46]. Received [3] in X is not equal to [4] in Y at i:2.
[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]

0
收藏
回复
全部评论(2)
时间顺序
长汀泽野
#2 回复于2023-07

就没有知道的大佬吗?

0
回复
AIStudio576306
#3 回复于2023-08

我也是推理的时候报错,但我是因为我下载的XFUND只有一个二进制文件,没有txt文件,有没有大佬知道怎么解决呢

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户