To support dynamic input shapes (e.g., replacing fixed dimensions with -1), use the infer_paddle_model_shape.py script. This allows you to re-export a model with updated input/output shapes, which can be verified using tools like Netron.
Use the following command structure:
--model_path: Path to the existing inference model directory.--save_path: Path where the updated model will be saved.--input_shape_dict: A JSON-formatted string mapping input names to their new shapes (e.g., "{'x':[-1,3,-1,-1]}").
python infer_paddle_model_shape.py --model_path ch_PP-OCRv2_det_infer/inference \-
--save_path ch_PP-OCRv2_det_infer/new_inference \-
--input_shape_dict="{'x':[-1,3,-1,-1]}"