[SAR] Exported model still throws “shape size 4 ≠ perm size 3” / “Conv expects 4-D” — leftover transpose2 after fine-tuning (Paddle 2.6.2) #15927
Unanswered
AliShafiee2003
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello, the performance of this model is not very good, and it is indeed not one of the high-priority models maintained by PaddleOCR at the moment. We highly recommend that you use the PP-OCRv5 configuration for model fine-tuning. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I'm having trouble with inference. It seems like different layers have different dimensions as input.
1. Environment
paddlepaddle/paddle:2.6.2-gpu-cuda12.0-cudnn8.9-trt8.6
)develop
(June 2025) cloned 2 weeks agooutput/rec/fa_r31_sar_finetune/best_accuracy.pdparams
combined_dict.txt
2. Training YAML (excerpt)
So H=64 and max W=256 during training.
3. Export steps tried
A. first export (default IR-optim on)
Inference with a trivial script (NCHW input) gave:
If I feed CHW instead, I get:
So whichever shape I send, one of the two ops fails.
B. predictor with IR-optim off
Added
cfg.switch_ir_optim(False)
in the inference script → same errors.C. re-export with
Global.ir_optim=False
Log shows “Ir optimization is turned off, no ir pass will be executed.”
But the new model still throws exactly the same two errors depending on 4-D vs 3-D input.
4. Minimal inference script
x
is NCHW → transpose2 perm mismatch (shape 4 vs 3).x
is CHW → first conv says “input must be 4-D”.5. Suspected cause
A stray
transpose2
op withperm=[2,1,0]
is still present before the firstconv2d
.So the graph expects:
but my export contains both
transpose2
andunsqueeze2
.This makes it impossible to satisfy both ops at once.
Several issues (#8970, #9631, #10934) mention the same leftover transpose after SAR export.
6. What I need
ir_optim=False
) to avoid inserting that 3-D transpose?transpose2
without manually editing the graph?Thanks for any guidance!
Beta Was this translation helpful? Give feedback.
All reactions