PaddleSlim icon indicating copy to clipboard operation
PaddleSlim copied to clipboard

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

Open ZIKAIHHUANG opened this issue 1 year ago • 1 comments

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

ZIKAIHHUANG avatar May 08 '24 02:05 ZIKAIHHUANG

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

另外也麻烦详细说明下

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

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

FrostML avatar May 08 '24 11:05 FrostML