-
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
ValueError: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3. #13874
Comments
Addition Info: |
The parameter you provided --rec_image_shape="3, 100, 100,320" contains four dimensions, while the error message indicates that the model expects an input shape with three dimensions. You can try changing the --rec_image_shape parameter to "3, 32, 320", which removes the extra dimension. |
Thank you for your help. But when i set --rec_image_shape parameter to "3, 32, 320". I get new error
image i'm using for predict is the image i ran for infer. |
Thank you very much! It's worked with shape 3x48x48x160! But i trained with shape 3x100x320 and exported the model. I think i can use that shape. |
🔎 Search before asking
🐛 Bug (问题描述)
I'm training a new language with model SAR and stuck in predict_rec.py
I run command:
python3 tools/infer/predict_rec.py --image_dir="./predict/0.jpg" --rec_model_dir="./inference/rec/sar" --rec_image_shape="3, 100, 100,320" --rec_char_dict_path="./ppocr/utils/vi_dict.txt"
it show me:
[2024/09/15 21:37:28] ppocr WARNING: The first GPU is used for inference by default, GPU ID: 0
[2024/09/15 21:37:35] 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
Backend GTK4Agg is interactive backend. Turning interactive mode on.
[2024/09/15 21:37:46] ppocr INFO: Traceback (most recent call last):
File "/home/workspace/PaddleOCR/tools/infer/predict_rec.py", line 860, in main
rec_res, _ = text_recognizer(img_list)
File "/home/workspace/PaddleOCR/tools/infer/predict_rec.py", line 706, in call
self.predictor.run()
ValueError: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3.
[Hint: Expected shape.size() == perm.size(), but received shape.size():4 != perm.size():3.] (at /paddle/paddle/phi/kernels/funcs/transpose_function.cu.h:663)
[operator < transpose2 > error]
[2024/09/15 21:37:46] ppocr INFO: (InvalidArgument) shape should have the save dim with perm, but received shape size is:4, perm size is:3.
[Hint: Expected shape.size() == perm.size(), but received shape.size():4 != perm.size():3.] (at /paddle/paddle/phi/kernels/funcs/transpose_function.cu.h:663)
[operator < transpose2 > error]
🏃♂️ Environment (运行环境)
My enviroment
OS: ubuntu 22.04 python 3.10.12 paddleocr & paddlepaddle: 2.6.1 CPU: i5 12400F RAM: 32GB GPU: GTX 1060 6G
🌰 Minimal Reproducible Example (最小可复现问题的Demo)
Thank you for any help
The text was updated successfully, but these errors were encountered: