You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
python3 tools/infer/predict_rec.py --image_dir='./image/12.jpg' --rec_model_dir='./inference/rec_mtb_nrtr/' --rec_algorithm='NRTR' --rec_image_shape='1,32,100' --rec_char_dict_path='./ppocr/utils/EN_symbol_dict.txt'
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
[2025/04/28 11:43:18] ppocr WARNING: The first GPU is used for inference by default, GPU ID: 0
[2025/04/28 11:43:20] ppocr INFO: In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320
norm_img_batch shape before inference: (1, 1, 32, 100)
[2025/04/28 11:43:21] ppocr INFO: Traceback (most recent call last):
File "/workspace/JP_FreeForm/tools/infer/predict_rec.py", line 937, in main
rec_res, _ = text_recognizer(img_list)
File "/workspace/JP_FreeForm/tools/infer/predict_rec.py", line 870, in call
self.predictor.run()
ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [1, 2, 1536], X's size = 3072, 'shape' is [1, 1, 3, 8, 64], the capacity of 'shape' is 1536.
[Hint: Expected capacity == in_size, but received capacity:1536 != in_size:3072.] (at /paddle/paddle/phi/infermeta/unary.cc:1955)
[operator < reshape2 > error]
[2025/04/28 11:43:21] ppocr INFO: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [1, 2, 1536], X's size = 3072, 'shape' is [1, 1, 3, 8, 64], the capacity of 'shape' is 1536.
[Hint: Expected capacity == in_size, but received capacity:1536 != in_size:3072.] (at /paddle/paddle/phi/infermeta/unary.cc:1955)
[operator < reshape2 > error]
@cuicheng01 Thanks for your quickly reply. Yes, i have try version 3.0 and still the same error was raised.
Can you take a look for this algothrim because it's has been released quite a long time and need some new documents.
Hope some good new from u!
Thanks.
@cuicheng01 More information that i can training and evaluation with pdparams smoothly but when i wanna export it to static pdinference, i counter this error. @Topdu and Topdu i know you are the author of this algorithm, can you give me some help or at least advice, thanks in advance!
🔎 Search before asking
🐛 Bug (问题描述)
I'm trying export and using NRTR model follow doc, but i encounter, i'm using paddlepaddle-gpu==2.6.2
Reproduce just download the weight and do the same follow the doc:
https://paddlepaddle.github.io/PaddleOCR/main/en/algorithm/text_recognition/algorithm_rec_nrtr.html#41-python-inference
python3 tools/infer/predict_rec.py --image_dir='./image/12.jpg' --rec_model_dir='./inference/rec_mtb_nrtr/' --rec_algorithm='NRTR' --rec_image_shape='1,32,100' --rec_char_dict_path='./ppocr/utils/EN_symbol_dict.txt'
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
[2025/04/28 11:43:18] ppocr WARNING: The first GPU is used for inference by default, GPU ID: 0
[2025/04/28 11:43:20] ppocr INFO: In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320
norm_img_batch shape before inference: (1, 1, 32, 100)
[2025/04/28 11:43:21] ppocr INFO: Traceback (most recent call last):
File "/workspace/JP_FreeForm/tools/infer/predict_rec.py", line 937, in main
rec_res, _ = text_recognizer(img_list)
File "/workspace/JP_FreeForm/tools/infer/predict_rec.py", line 870, in call
self.predictor.run()
ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [1, 2, 1536], X's size = 3072, 'shape' is [1, 1, 3, 8, 64], the capacity of 'shape' is 1536.
[Hint: Expected capacity == in_size, but received capacity:1536 != in_size:3072.] (at /paddle/paddle/phi/infermeta/unary.cc:1955)
[operator < reshape2 > error]
[2025/04/28 11:43:21] ppocr INFO: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [1, 2, 1536], X's size = 3072, 'shape' is [1, 1, 3, 8, 64], the capacity of 'shape' is 1536.
[Hint: Expected capacity == in_size, but received capacity:1536 != in_size:3072.] (at /paddle/paddle/phi/infermeta/unary.cc:1955)
[operator < reshape2 > error]
Thanks in advanced!
🏃♂️ Environment (运行环境)
ubtuntu
paddlepaddle-gpu==2.6.2
latest paddleocr
🌰 Minimal Reproducible Example (最小可复现问题的Demo)
python3 tools/infer/predict_rec.py --image_dir='./doc/imgs_words_en/word_10.png' --rec_model_dir='./inference/rec_mtb_nrtr/' --rec_algorithm='NRTR' --rec_image_shape='1,32,100' --rec_char_dict_path='./ppocr/utils/EN_symbol_dict.txt'
The text was updated successfully, but these errors were encountered: