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

paddlepaddle/paddle:3.0.0b2表格识别报错:InvalidArgumentError: The shape of input[0] and input[1] is expected to be equal #14163

Open
3 tasks done
kenekai opened this issue Nov 5, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@kenekai
Copy link

kenekai commented Nov 5, 2024

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

docker 在paddlepaddle/paddle:3.0.0b2环境尝试表格识别报错,提示:In user code:\n\n\n InvalidArgumentError: The shape of input[0] and input[1] is expected to be equal.But received input[0]'s shape = [], input[1]'s shape = [1].\n [Hint: Expected inputs_dims[i].size() == out_dims.size(), but received inputs_dims[i].size():1 != out_dims.size():0.] (at /paddle/paddle/phi/kernels/funcs/concat_funcs.h:55)\n [operator < pd_kernel.phi_kernel > error]
image

同样配置在paddlepaddle/paddle:2.6.2环境可以正常表格识别
image

🏃‍♂️ Environment (运行环境)

paddle = paddlepaddle/paddle:3.0.0b2
model = ch_ppstructure_mobile_v2.0_SLANet_infer/ch_ppstructure_openatom_SLANetv2_infer、ch_PP-OCRv4_det_infer、ch_PP-OCRv4_rec_infer

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

python table/predict_structure.py --table_model_dir=../inference/ch_ppstructure_openatom_SLANetv2_infer/ --table_char_dict_path=../ppocr/utils/dict/table_structure_dict.txt --image_dir=docs/table/table.jpg --output=../output/table_slanet_lcnetv2 --use_gpu=False --enable_mkldnn=True --table_max_len=512

@UserWangZz UserWangZz assigned UserWangZz and cuicheng01 and unassigned UserWangZz Nov 6, 2024
@UserWangZz
Copy link
Collaborator

试试使用paddlex可以正常推理吗?paddle3.0.0b2可能需要重新进行一下模型导出

@kenekai
Copy link
Author

kenekai commented Nov 7, 2024

试试使用paddlex可以正常推理吗?paddle3.0.0b2可能需要重新进行一下模型导出
请问paddle3.0.0b2重新进行一下模型导出有教程吗?

@UserWangZz
Copy link
Collaborator

文档里就有,用paddle3.0.0b2将动态图重新导出一下试试

@cuicheng01
Copy link
Collaborator

请问该如何复现呢?目前无法复现

@GreatV GreatV added the bug Something isn't working label Nov 17, 2024
@77bw
Copy link

77bw commented Dec 2, 2024

尝试使用paddlex可以正常推理吗?paddle3.0.0b2可能需要重新进行一下模型导出

我也安装最新的docker也遇到这个问题 请问具体的模型导出文档再哪里呢 我找不到谢谢

@zhenwang1219
Copy link

同样遇到了,我没有用docker,使用命令:
paddleocr --image_dir={带有table的图片或者pdf} --type=structure --table=true --recovery=true --recovery_to_markdown=true --lang='ch'
设置--table=true的时候稳定报错:
image
设置--table=false的时候正常运行:
image
image

@chelseaztq
Copy link

同样的问题

@yiyahei-eng
Copy link

问题一,图片中提取表格报错InvalidArgumentError,使用python中的标准库,paddleocr版本是2.9.1,怎么能够解决这个问题?
问题二,识别提取文字图片无法按照原位置恢复版面导出

@cuicheng01
Copy link
Collaborator

cuicheng01 commented Dec 30, 2024

我复现了问题,应该是paddle的默认行为导致了这个差异,我们需要将这个模型重新导出再上传一下,并且更改相关的模型代码,我先提供一个绕过去的方式:

  1. 下载https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b2/SLANet_infer.tar 权重
  2. 替换本地的SLANet的权重
  3. 重新infer,解决问题
    PaddleOCR fix PR:update SLANet inference weights for adapt to paddle3.0b2 #14467

@cuicheng01
Copy link
Collaborator

修复PR已经合入,可以拉取main分支的代码,重新构建wheel,即可解决问题。当然paddleocr的下一个版本的wheel也会体现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants