-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
使用rec_r34_vd_tps_bilstm_ctc模型预测失败,请问如何解决? #78
Comments
|
@LDOUBLEV 我的运行指令如下: python3 tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_ctc.yml -o Global.checkpoints=./ch_lite/ec_r34_vd_tps_bilstm_ctc/best_accuracy 在/inference/rec/rec_r34_vd_tps_bilstm_ctc/ 成功生成了model和params文件。 |
@tink2123 你好 我已经设置了相同的参数,并且更换了预测图片(英文),安装了paddlepaddle1.7.2,但是还是报了相同的错误。按照相同的方法下载了rec_crnn.tar,转化成iinference的model和params之后,就能预测成功。 |
预测时添加参数也报错吗? 预测时的命令可以发一下吗? |
@tink2123 这是我预测命令。帖子的错误就是加载rec_r34_vd_tps_bilstm_ctc模型的时候报错的,但是加载rec_crnn就能预测成功。 |
请试一下这个命令: rec_crnn 模型中没有grid_sampler这个op,所以没有影响。 |
@tink2123 已经成功了,谢谢你!我原本只是在rec_r34_vd_tps_bilstm_ctc.yml中修改参数,并且在utility中的 parser.add_argument中添加default路径,直接运行predict_system的,没注意修改rec_image_shape和rec_char_type的默认值。另外多问一句,这个模型只能预测英文小写字母和数字,是吧? |
是的,目前发布的模型中,除了9m轻量级模型外,都只能预测英文。需要的话,您可以使用自己的中文数据训练后进行预测。 |
@tink2123 好的 非常感谢! |
开发环境:
win10,conda安装paddlepaddle=1.8。
已经成功生成model和params文件,只是部署预测的时候出了错。
运行predict_system的时候报错如下:
Traceback (most recent call last):
File "E:/jiajun LUO/OCR/PaddleOCR-develop/tools/infer/predict_system.py", line 121, in
dt_boxes, rec_res = text_sys(img)
File "E:/jiajun LUO/OCR/PaddleOCR-develop/tools/infer/predict_system.py", line 81, in call
rec_res, elapse = self.text_recognizer(img_crop_list)
File "E:\jiajun LUO\OCR\PaddleOCR-develop\tools\infer\predict_rec.py", line 81, in call
self.predictor.zero_copy_run()
paddle.fluid.core_avx.EnforceNotMet:
C++ Call Stacks (More useful to developers):
Windows not support stack backtrace yet.
Python Call Stacks (More useful to users):
File "F:\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op
attrs=kwargs.get("attrs", None))
File "F:\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "F:\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\layers\nn.py", line 13779, in grid_sampler
helper.append_op(type='grid_sampler', inputs=ipts, outputs={'Output': out})
File "E:\jiajun LUO\OCR\PaddleOCR-develop\ppocr\modeling\stns\tps.py", line 259, in call
batch_I_r = layers.grid_sampler(x=image, grid=batch_P_prime)
File "E:\jiajun LUO\OCR\PaddleOCR-develop\ppocr\modeling\architectures\rec_model.py", line 98, in call
inputs = self.tps(image)
File "E:\jiajun LUO\OCR\PaddleOCR-develop\tools\program.py", line 198, in build_export
image, outputs = model(mode='export')
File "E:/jiajun LUO/OCR/PaddleOCR-develop/tools/export_model.py", line 68, in main
config, eval_program, startup_prog)
File "E:/jiajun LUO/OCR/PaddleOCR-develop/tools/export_model.py", line 94, in
main()
Error Message Summary:
InvalidArgumentError: Input(X) dims[3] and Input(Grid) dims[2] should be equal, but received X dimension3 != Grid dimension2
[Hint: Expected grid_dims[2] == x_dims[3], but received grid_dims[2]:100 != x_dims[3]:382.] at (D:\1.8.0cpu2\paddle\paddle\fluid\operators\grid_sampler_op.cc:72)
[operator < grid_sampler > error]
The text was updated successfully, but these errors were encountered: