PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
43.59k stars 7.77k forks source link

StyleText运行错误 #3137

Closed Onion-Skins closed 1 year ago

Onion-Skins commented 3 years ago

在Ubuntu 20.04上安装的PaddleOCR和StyleText,并且运行例子没有问题。 但当运行我自己的一张图片(397x32)的时候就出现错误: Traceback (most recent call last): File "/home/rodger/PaddleOCR/StyleText/tools/synth_image.py", line 82, in synth_image() File "/home/rodger/PaddleOCR/StyleText/tools/synth_image.py", line 35, in synth_image synth_result = image_synthesiser.synth_image(text_corpus, img, language) File "/home/rodger/PaddleOCR/StyleText/engine/synthesisers.py", line 43, in synth_image synth_result = self.predictor.predict(style_input, text_input_list) File "/home/rodger/PaddleOCR/StyleText/engine/predictors.py", line 81, in predict synth_result = self.predict_single_image(style_input, text_input) File "/home/rodger/PaddleOCR/StyleText/engine/predictors.py", line 53, in predict_single_image style_text_result = self.generator.forward(tensor_style_input, File "/home/rodger/PaddleOCR/StyleText/arch/style_text_rec.py", line 59, in forward bg_gen_output = self.bg_generator.forward(style_input) File "/home/rodger/PaddleOCR/StyleText/arch/style_text_rec.py", line 220, in forward decode_bg_output = self.decoder_bg(encode_bg_output["res_blocks"], File "/home/rodger/venv/myocr/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 891, in call outputs = self.forward(*inputs, **kwargs) File "/home/rodger/PaddleOCR/StyleText/arch/decoder.py", line 247, in forward paddle.concat( File "/home/rodger/venv/myocr/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 124, in concat return paddle.fluid.layers.concat(input=x, axis=axis, name=name) File "/home/rodger/venv/myocr/lib/python3.8/site-packages/paddle/fluid/layers/tensor.py", line 306, in concat return core.ops.concat(input, 'axis', axis) ValueError: (InvalidArgument) The 3-th dimension of input[0] and input[1] is expected to be equal.But received input[0]'s shape = [1, 128, 16, 200], input[1]'s shape = [1, 128, 16, 199].

[operator < concat > error]

换另一张图片的时候也是出现类似错误,都是shape的最后一个数字差别为1。 请问这是什么原因引起的呢?是Config.yml中的配置问题吗? 我只是在样板配置上修改了图片尺寸而已。

多谢指教!

LDOUBLEV commented 3 years ago

图像的宽度设置为32的倍数试试?

Onion-Skins commented 3 years ago

@LDOUBLEV 确实将宽度设为32的倍数就可以了! 这个配置文件中的宽度设定可以和图片的实际宽度不同吗?那么两者什么关系呢?

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.