您好,使用en_numen_number_mobile_v2.0_rec_infer.pth时会报错
按照提示都改成--rec_image_shape='3,32,100' and --rec_char_type='en' 还会报下面的错误,
Please read the FAQ:https://github.com/PaddlePaddle/PaddleOCR#faq If your model has tps module: TPS does not support variable shape. Please set --rec_image_shape='3,32,100' and --rec_char_type='en' list index out of range
@libenchong 完整的命令和报错麻烦发出来看下。
命令:python3 ./tools/infer/predict_rec.py --rec_model_path ./en_number_mobile_v2.0_rec_infer.pth --rec_char_type en --rec_char_dict_path ./pytorchocr/utils/dict/en_dict.txt --image_dir ./doc/imgs_words/en
{'fc_decay': 4e-05, 'in_channels': 96} weighs is loaded. /home/ilab/anaconda3/envs/pyship/lib/python3.9/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /opt/conda/conda-bld/pytorch_1623448255797/work/c10/core/TensorImpl.h:1156.) return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) ERROR!!!! Please read the FAQ:https://github.com/PaddlePaddle/PaddleOCR#faq If your model has tps module: TPS does not support variable shape. Please set --rec_image_shape='3,32,100' and --rec_char_type='en' list index out of range
@libenchong 由于这里是根据PaddleOCRv2.3改的,使用en模型命令:
python3 ./tools/infer/predict_rec.py --rec_model_path ./en_number_mobile_v2.0_rec_infer.pth --rec_char_dict_path ./pytorchocr/utils/dict/en_dict.txt --image_dir ./doc/imgs_words/en
您好,使用您给的命令还是报之前错误
您确认一下,不需要指定rec_char_type。或者把完整截图发上来看看

我这边没复现出问题。试一下把main函数里的try...except去掉,直接rec_res, predict_time = text_recognizer(img_list),再运行看看会报什么错。
您好,按照您的把try...except去掉后,报数组越界

您好,我这边找到错误了,错误是在PaddleOCR2Pytorch-main/pytorchocr/postprocess/rec_postprocess.py第45行self.character_str = "0123456789abcdefghijklmnopqrstuvwxyz"这句代码上,它没读en_dict里面的字符,我把en_dict里面的字符里面的字符放到这句代码里面还是报错,您能重新提供一份en_dict.txt 吗?
您好,bug解决了,PaddleOCR2Pytorch-main/pytorchocr/postprocess/rec_postprocess.py第45行self.character_str = "0123456789abcdefghijklmnopqrstuvwxyz"这句代码上,它没读en_dict里面的字符,另外您提供的en_dict.txt和百度官方的不一致,可以更新一下
好的。我这边看en_dict.txt和官方是一致的
您好,我从您github这边看到的en_dict.txt里面是有62个字符, 在百度官方PaddleOCR/ppocr/utils/en_dict.txt里面有94个字符

您好,我从您github这边看到的en_dict.txt里面是有62个字符, 在百度官方PaddleOCR/ppocr/utils/en_dict.txt里面有94个字符
是这个en_dict.txt,不是PaddleOCR/ppocr/utils/en_dict.txt
您好,我用62个字符的en_dict.txt报越界异常,换成94个字符的en_dict.txt就不报异常了
要不加个qq跟你说
我的qq:3503736128
For people suffering from same problems, I solve this problem by changing the line 29 in 'PaddleOCR2Pytorch-main/pytorchocr/postprocess/rec_postprocess.py'
from if character_dict_path is 'en': to if character_dict_path is None:
94个字符的en_dict.txt就不报异常了
是的 我调整94个字符的字典之后 就不报异常了