Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

离线量化paddleocr文字识别模型报错问题ValueError: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3 #1872

Open
ZIKAIHHUANG opened this issue May 8, 2024 · 1 comment
Assignees

Comments

@ZIKAIHHUANG
Copy link

Traceback (most recent call last):
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2843, in
sys.exit(main())
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2831, in main
app, _win = get_main_app(sys.argv)
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2821, in get_main_app
win = MainWindow(lang=args.lang,
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 114, in init
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel..\paddleocr.py", line 682, in ocr
dt_boxes, rec_res, _ = self.call(img, cls)
dt_boxes, elapse = self.text_detector(img)
File "F:\hzk\PaddleOCR-2.7.5\tools\infer\predict_det.py", line 250, in call
self.predictor.run()
ValueError: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3.
[Hint: Expected shape.size() == perm.size(), but received shape.size():4 != perm.size():3.] (at ../paddle/phi/kernels/funcs/transpose_func
tion.cu.h:663)
[operator < transpose2 > error]
(PaddleOCR) PS F:\hzk\PaddleOCR-2.7.5\PPOCRLabel> python PPOCRLabel.py --lang ch
[2024/05/07 17:13:43] ppocr WARNING: When args.layout is false, args.ocr is automatically set to false
Traceback (most recent call last):
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2846, in
sys.exit(main())
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2834, in main
app, _win = get_main_app(sys.argv)
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 2824, in get_main_app
win = MainWindow(lang=args.lang,
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel\PPOCRLabel.py", line 112, in init
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
File "F:\hzk\PaddleOCR-2.7.5\PPOCRLabel..\paddleocr.py", line 682, in ocr
dt_boxes, rec_res, _ = self.call(img, cls)
File "F:\hzk\PaddleOCR-2.7.5\tools\infer\predict_system.py", line 75, in call
dt_boxes, elapse = self.text_detector(img)
File "F:\hzk\PaddleOCR-2.7.5\tools\infer\predict_det.py", line 250, in call
self.predictor.run()
ValueError: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3.
[Hint: Expected shape.size() == perm.size(), but received shape.size():4 != perm.size():3.] (at ../paddle/phi/kernels/funcs/transpose_func
tion.cu.h:663)
[operator < transpose2 > error]
配置文件:ch_PPOCRv4_rec.yml

@FrostML
Copy link

FrostML commented May 8, 2024

仅看报错只是在说 transpose 时候的维度设置不对,进一步定位可以在具体代码处打印看看是哪一个变量的形状有问题。

另外也麻烦详细说明下

  1. 环境信息,包括不限于:
    PaddlePaddle 的版本
    PaddleSlim 的版本
    PaddleOCR 的版本
    CUDA CUDNN 版本

  2. 执行的方式:
    执行的是动态图前向还是导出模型后的 inference 推理
    执行的命令是怎样的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants