PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

InvalidArgumentError: Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [1, 96, 3, 12] and the shape of Y = [1, 96, 4, 12]. 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:84) [operator < elementwise_add > error]

Open sunwangyan opened this issue 2 years ago • 1 comments

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:
  • 完整报错/Complete Error Message:

系统:win11 paddle: paddlepaddle-gpu 2.3.2 paddleOCR: 2.6.02 PPOCRLable: 2.6 运行指令:PPOCRLabel.py --lang ch --kie True

报错

Traceback (most recent call last): File "D:/python_by/PyCharm 2022.2.3/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "D:\python_by\PyCharm 2022.2.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:\OCR\PaddleOCR\PPOCRLabel\PPOCRLabel.py", line 2840, in sys.exit(main()) File "D:\OCR\PaddleOCR\PPOCRLabel\PPOCRLabel.py", line 2828, in main app, _win = get_main_app(sys.argv) File "D:\OCR\PaddleOCR\PPOCRLabel\PPOCRLabel.py", line 2821, in get_main_app default_predefined_class_file=args.predefined_classes_file) File "D:\OCR\PaddleOCR\PPOCRLabel\PPOCRLabel.py", line 112, in init result = self.ocr.ocr('./data/paddle.png', cls=True, det=True) File "D:\OCR\PaddleOCR\PPOCRLabel\venv\lib\site-packages\paddleocr\paddleocr.py", line 536, in ocr for box, res in zip(dt_boxes, rec_res)] File "..\tools\infer\predict_system.py", line 87, in call img_crop_list) File "..\tools\infer\predict_cls.py", line 111, in call self.predictor.run() ValueError: In user code:

File "tools/export_model.py", line 172, in <module>
  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 "<decorator-gen-101>", 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 "<decorator-gen-99>", 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 = [1, 96, 3, 12] and the shape of Y = [1, 96, 4, 12]. 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:84)
  [operator < elementwise_add > error]

sunwangyan avatar Oct 21 '22 02:10 sunwangyan

u can try the solution in https://github.com/PaddlePaddle/PaddleOCR/issues/7760~

thsno02 avatar Oct 24 '22 00:10 thsno02